Pull the matching rows with FILTER
Formulas that spill8 minPremium
Builds on Fill a range with one formula, and fix #SPILL! and Combine tests with AND, OR and NOT.
Every morning the team lead of a support desk in Austin needs the open tickets out of a log that runs to hundreds of rows. One FILTER formula gives her that list beside the log, and the list changes as tickets close.
How it works
FILTER( returns the rows of array whose include value is TRUE. include is a test written over a whole column, such as C2:C20=, which gives one TRUE or FALSE for each row, so it covers the same rows as array.
Picture a sieve: every row carries its TRUE or FALSE, and only the TRUE rows fall through, in their original order. The source stays as it is, and the result changes as soon as the data does.
For two tests that must both pass, multiply them: (C2:C20=. TRUE counts as 1 and FALSE as 0, so the product is 1 only when both are TRUE. Add the tests instead and a row passes when either one is TRUE. When no row passes, FILTER shows #CALC!, unless the third argument gives text to show instead.
Example
A bakery's supply list has the stock of each item in B2:B10 and the level that triggers an order in C2:C10.
=FILTER(A2:A10,B2:B10<C2:C10,"Nothing to order")- Step 1: The test
B2:B10<asks of every row whether the stock is below its reorder level.C2:C10 - Step 2: Flour, butter, yeast and cocoa are below it, so their rows are TRUE.
- Step 3: D2 lists those four items, in the order they come in the list.
Common mistakes
=FILTER(mixes ranges of different heights and showsA2:A10, B2:B9< C2:C9) #VALUE!. Start and end every range on the same rows.AND(gives one TRUE or FALSE for both whole ranges, so FILTER showsC2:C20= "Open", D2:D20= "North") #VALUE!. Multiply the tests instead, each in brackets.- Without the third argument, a test that no row passes shows
#CALC!. Give the text to show, such as"None". - A test with the value typed in, such as
D2:D20=, has to be edited for the next region. Point it at a cell that holds the region."North"
In short
=FILTER(lists the rows where the test is TRUE.rows to return, test, text if none) - Write the test over the whole column, on the same rows as the result.
- Multiply tests when both must pass and add them when either will do, each in brackets.
- Give the third argument, or an empty result shows
#CALC!.
Practice
Premium4 exercises: 3 formulas and 1 quiz question.
Practice is part of Premium
Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.
Have one? Sign in