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.

FILTER availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019No
Excel 2016No

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.

Orders (A1:E9)
RowABCDE
1Order IDRepRegionProductAmount
21001AnaNorthLaptop1200
31002BenSouthMonitor300
41003AnaNorthMonitor350
51004CaraEastLaptop1150
61005BenSouthLaptop1250
71006DevWestKeyboard80
81007CaraEastMonitor320
91008AnaSouthKeyboard90
  1. 1.All orders from one region

    =FILTER(A2:E9, C2:C9="South")

    Result: Spills 3 rows

    1002BenSouthMonitor300
    1005BenSouthLaptop1250
    1008AnaSouthKeyboard90

    Every row whose Region is South, in the original order.

  2. 2.Two conditions (AND)

    =FILTER(A2:E9, (B2:B9="Ana")*(E2:E9>100))

    Result: Spills 2 rows

    1001AnaNorthLaptop1200
    1003AnaNorthMonitor350

    Multiplying the tests keeps rows where both are true; Ana's 90 order drops out.

  3. 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

FILTER errors, causes and fixes
ErrorWhy it happensFix
#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.

your-file.xlsx

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.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

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