Dynamic arrays function
FILTER function in Google Sheets and Excel
FILTER returns every row of a range that meets a condition, spilled into the cells below.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
FILTER(array, include, [if_empty])Arguments in [brackets] are optional. Google Sheets writes it FILTER(range, condition1, [condition2]).
Example
=FILTER(A2:A9,B2:B9="North") reads: Return the names A2:A9 of every rep whose region B2:B9 is North.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Rep | Region | Jul | Aug | Sep | Target | North reps | |
| 2 | Amara Osei | North | $12,400 | $13,100 | $11,800 | $36,000 | Amara Osei | |
| 3 | Ben Fischer | South | $9,800 | $10,250 | $12,100 | $30,000 | Eva Novak | |
| 4 | Lina Chen | East | $15,200 | $14,800 | $16,900 | $45,000 | ||
| 5 | Diego Alvarez | West | $8,700 | $9,100 | $8,400 | $28,000 | ||
| 6 | Eva Novak | North | $11,200 | $12,600 | $13,900 | $36,000 | ||
| 7 | Farid Haddad | South | $13,300 | $12,900 | $14,100 | $39,000 | ||
| 8 | Grace Kim | East | $10,100 | $9,600 | $10,800 | $33,000 | ||
| 9 | Hugo Martin | West | $14,500 | $15,800 | $15,100 | $42,000 |
H2 and H3 show Amara Osei and Eva Novak: the two North reps. One formula filled two cells.
How the spreadsheet calculates it
Keeps the rows of A2:A9 where B2:B9 is equal to "North", and spills them into the cells below. If nothing matches, Excel shows #CALC!.
- 1. FILTER: Keeps the rows of
A2:A9whereB2:B9is equal to"North", and spills them into the cells below. If nothing matches, Excel shows#CALC!.array=`A2:A9`: what to returninclude=`B2:B9="North"`: a TRUE/FALSE test per row
More FILTER examples
=FILTER(A2:A9,B2:B9="North")Every North rep.=FILTER(A2:E9,(B2:B9="South")*(E2:E9>12000))Whole rows for South reps over 12,000 in September.=FILTER(A2:A9,(B2:B9="North")+(B2:B9="East"))Reps in the North or the East.=SORT(FILTER(A2:C9,C2:C9>10000),3,-1)Matching rows, sorted by the third column, highest first.
Paste any of these into the formula explainer to see it step by step.
Tips
- Always give the third argument in Excel when “no matches” is possible, so dependent formulas don't inherit #CALC!.
- Leave empty space below a FILTER for the result to grow into.
- Build complex conditions in a helper column first to check them, then move them into include.
- Multiply conditions for AND and add them for OR; AND() and OR() return one value for the whole range.
What FILTER is used for
Live lists that update themselves: open tickets for one agent, orders over a threshold, everyone in one department, without copying or re-filtering by hand.
Arguments
| Argument | Required | What it is |
|---|---|---|
| array | Yes | The range to filter: one column or whole rows. |
| include | Yes | A TRUE/FALSE column as tall as array, like B2:B9="North". Multiply conditions for AND, add them for OR.Watch out: A different height returns an error. |
| if_empty | No | What to show when no row matches, instead of #CALC!. |
Common mistakes
Typing in the cells the result needs: #SPILL!.
A condition range of a different height from the array.
Using AND() or OR() inside include: they return one value, not one per row.
Typing in the cells the result needs, which gives #SPILL!.
In Google Sheets
Google Sheets' FILTER takes extra conditions as extra arguments and has no if_empty: when nothing matches it returns #N/A, so wrap it in IFNA.
Errors you may see with FILTER
- #CALC!: No row matches and there's no if_empty.
- #SPILL!: Something blocks the cells the result needs.
- #VALUE!: include isn't the same height as array. How to fix it.
Questions
Which versions have FILTER?
Excel 2021, Excel 2024, Microsoft 365 and Google Sheets. See the FILTER guide for older versions.
How do I count what FILTER returns?
ROWS(FILTER(…)), or COUNTIFS with the same conditions.
Can FILTER return only some columns?
Give it only those columns as the array, like FILTER(A2:A9, …) for names. For columns that aren't next to each other, write one FILTER per column with the same include, side by side.
Sources
Official documentation the facts on this page were checked against.