Excel functions · Dynamic arrays
FILTER function in Excel
FILTER returns the rows of a range that meet one or more conditions, as a live list that updates when the data changes, such as every order from the South region. Combine conditions with * for AND and + for OR, and use the third argument to say what to show when nothing matches.
Last reviewed
Syntax
=FILTER(array, include, [if_empty])- arrayrequired
- The range to filter, such as A2:E9.
- includerequired
- A TRUE/FALSE test with one entry per row (or column), such as C2:C9="South".
- if_emptyoptional
- What to return when no rows pass, such as "No orders". Without it, an empty result is #CALC!.
- The result spills: type the formula in one cell and it fills as many cells as it needs, and it updates when the data changes.
- AND: (B2:B9="Ana")*(E2:E9>100). OR: (C2:C9="East")+(C2:C9="West").
- Wrap it in SORT to filter and sort in one go: =SORT(FILTER(A2:E9, C2:C9="South"), 5, -1).
Which versions have FILTER
Microsoft 365, Excel for the web, and Excel 2021 or later (Windows and Mac). Not in Excel 2019 or 2016.
| Version | Has it |
|---|---|
| Microsoft 365 (Windows and Mac) | Yes |
| Excel for the web | Yes |
| Excel 2024 | Yes |
| Excel 2021 | Yes |
| Excel 2019 | No |
| Excel 2016 | No |
Google Sheets
Google Sheets has FILTER with a different shape: FILTER(range, condition1, [condition2, ...]). Each extra condition is its own argument (joined with AND), there's no if_empty argument, and no match returns #N/A.
Examples
The examples use this sample sheet.
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Order ID | Rep | Region | Product | Amount |
| 2 | 1001 | Ana | North | Laptop | 1200 |
| 3 | 1002 | Ben | South | Monitor | 300 |
| 4 | 1003 | Ana | North | Monitor | 350 |
| 5 | 1004 | Cara | East | Laptop | 1150 |
| 6 | 1005 | Ben | South | Laptop | 1250 |
| 7 | 1006 | Dev | West | Keyboard | 80 |
| 8 | 1007 | Cara | East | Monitor | 320 |
| 9 | 1008 | Ana | South | Keyboard | 90 |
1.All orders from one region
=FILTER(A2:E9, C2:C9="South")Result: Spills 3 rows
1002 Ben South Monitor 300 1005 Ben South Laptop 1250 1008 Ana South Keyboard 90 Every row whose Region is South, in the original order.
2.Two conditions (AND)
=FILTER(A2:E9, (B2:B9="Ana")*(E2:E9>100))Result: Spills 2 rows
1001 Ana North Laptop 1200 1003 Ana North Monitor 350 Multiplying the tests keeps rows where both are true; Ana's 90 order drops out.
3.Nothing matches
=FILTER(A2:E9, C2:C9="Central", "No orders")Result: No orders
There's no Central region, so FILTER returns the if_empty text instead of #CALC!.
Common errors and fixes
| Error | Why it happens | Fix |
|---|---|---|
| #CALC! | No rows pass the test and if_empty is missing. | Add a third argument such as "No orders". |
| #VALUE! | include isn't the same height as array, such as A2:E9 with C2:C10. | Make the test cover exactly the same rows. |
| #SPILL! | The result needs more cells than are free: something is in the way, or the formula is inside an Excel table. | Clear the cells below and to the right, or move the formula outside the table. |
| #NAME? | Your Excel doesn't have dynamic array functions (Excel 2019 or older). | Open the file in Microsoft 365, Excel for the web, or Excel 2021 or later. |
Do it with GPTExcel
Skip writing FILTER by hand
Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.
List every South order over 200, sorted by amount, on a new sheet.
Done. I used FILTER on your sheet and checked the results against your data.
- Written for your platform and version
- Checked against your actual data
- Newest functions looked up in official docs
FILTER questions
- How do I filter with OR in Excel?
- Add the tests: =FILTER(A2:A9, (C2:C9="East")+(C2:C9="West")) returns 1004, 1006 and 1007 on the sample data. Multiplying them (*) means AND.
- Why does FILTER return #CALC!?
- Because no rows met the condition and there's no if_empty value. Add one as the third argument: =FILTER(A2:E9, C2:C9="Central", "No orders").
- Is FILTER the same in Google Sheets?
- Not quite. Sheets takes each condition as a separate argument, has no if_empty argument, and returns #N/A when nothing matches. Wrap it in IFERROR or IFNA to show a message.
Skip the formula hunt
Upload a spreadsheet and ask in plain English. Free plan, no credit card.
Start free