FILTER Function in Excel: Return Matching Rows Automatically

FILTER function in Excel illustration: a funnel passing matching green rows from a table into a new spilled list

Scrolling through a long order log and copying matching rows by hand is slow and error-prone. The FILTER function in Excel does the job with a single formula: you tell it which range to look at and which condition to test, and it spills every matching row into the sheet. When the source data changes, the result updates instantly—no AutoFilter clicks, no copy-paste, no helper columns.

Availability & Compatibility: According to the official FILTER function documentation, FILTER works in Excel for Microsoft 365 (Windows and Mac), Excel for the web, Excel 2024, and Excel 2021, plus the Excel mobile apps. Excel 2019 and older do not support dynamic arrays and will show #NAME?.

FILTER Function in Excel: Syntax and Arguments

FILTER takes a range plus a TRUE/FALSE test of the same height (or width) and returns only the rows where the test is TRUE. Here is the syntax:

=FILTER(array, include, [if_empty])
  • array (Required): The range or array to filter, such as the whole table A6:F17.
  • include (Required): A Boolean test with the same number of rows as array, for example C6:C17="East".
  • if_empty (Optional): What to show when nothing matches, such as "No orders". Without it, an empty result returns #CALC!.

Because the result is a dynamic array, you type the formula in one cell only and Excel spills it down and across. You never need absolute references or Ctrl+Shift+Enter.

Step-by-Step Example: Filter a Sales Order Log

The practice workbook below uses a Q4 order log in A5:F17 with the columns Order ID, Rep, Region, Product, Units, and Revenue ($). There are 12 orders across East, West, North, and South, and cell B3 holds the region you want to see.

1. Return All Rows for One Region

Type this in A21 to return every East order. Change B3 to West and the list rebuilds itself:

=FILTER(A6:F17, C6:C17=B3, "No orders")

With B3 set to East, Excel spills four rows: orders 1001, 1004, 1006, and 1009.

2. Multiple Criteria With AND Logic

Multiply two tests with * to keep rows where both conditions are TRUE. This returns East orders worth at least $5,000:

=FILTER(A6:F17, (C6:C17="East")*(F6:F17>=5000), "No orders")

Only orders 1001 ($5,200) and 1009 ($5,280) pass both tests.

3. Multiple Criteria With OR Logic

Add the tests with + to keep rows where either condition is TRUE:

=FILTER(A6:F17, (D6:D17="Laptop")+(D6:D17="Monitor"), "No orders")

This spills six orders (1001, 1002, 1005, 1007, 1009, 1011). Note that the test is an exact match, so Laptop Pro and Monitor Pro are excluded.

4. Sort the Filtered Results

Wrap FILTER in SORT to rank the output. Here, West orders are sorted by the 6th column (Revenue) in descending order:

=SORT(FILTER(A6:F17, C6:C17="West"), 6, -1)

The result starts with order 1007 ($6,500), followed by 1012 ($2,960), 1002 ($2,400), and 1008 ($1,680).

5. Return Only Selected Columns

To show just the Rep and Revenue of large orders, combine FILTER with CHOOSECOLS (Excel for Microsoft 365, Excel for the web, and Excel 2024):

=CHOOSECOLS(FILTER(A6:F17, F6:F17>=5000), 2, 6)

Five reps appear, from Aarav Shah ($5,200) to Liam Carter ($9,100). If you reuse the same filtered block several times in one formula, store it once with the LET function in Excel.

6. Partial Text Matches

FILTER has no wildcard argument, but ISNUMBER(SEARCH()) turns a “contains” test into TRUE/FALSE values:

=FILTER(A6:F17, ISNUMBER(SEARCH("Pro", D6:D17)), "No match")

This returns orders 1003, 1006, and 1012—every product whose name contains Pro (case-insensitive).

7. Summarize a Filtered List

Feed the result into an aggregate function to get one number. This totals revenue for the region in B3:

=SUM(FILTER(F6:F17, C6:C17=B3, 0))

For East, the answer is $15,530. Using 0 as if_empty keeps the total at zero instead of an error when a region has no orders.

FILTER vs. AutoFilter vs. XLOOKUP

Pick the right tool based on what you need back:

FeatureFILTER FunctionAutoFilter (Data Tab)XLOOKUP
ReturnsAll matching rowsHides non-matching rowsFirst (or last) match only
Updates automaticallyYes, on every recalculationNo, reapply after editsYes
Original dataUntouched; results spill elsewhereRows hidden in placeUntouched
Multiple criteria* for AND, + for ORDropdown per columnNeeds array tricks
Best forLive reports and dashboardsQuick one-off browsingSingle-value lookups

Need just one value, such as the price of a single product? Use XLOOKUP in Excel instead.

Troubleshooting #CALC!, #SPILL!, and #VALUE! Errors

  • #CALC!: No rows matched and you left out if_empty. Add a third argument such as "No orders" or "".
  • #SPILL!: Something is blocking the output area. Clear the cells below and to the right of the formula—see how to fix the #SPILL! error in Excel.
  • #VALUE!: The include range is a different size from array. For example, A6:F17 must be paired with a 12-row test such as C6:C17.
  • Results don’t grow with new data: Convert the range to an Excel table (Ctrl+T) and use structured references so the formula picks up new rows automatically.
  • #REF! from another workbook: Microsoft notes that dynamic arrays linked to a closed workbook return #REF! on refresh. Keep the source open, or read more about spilled array behavior.

Frequently Asked Questions

What does the FILTER function do in Excel?

FILTER returns every row (or column) of a range that meets a condition you define, and spills the results into neighboring cells. The output updates automatically when the source data changes.

How do I use multiple criteria in FILTER?

Wrap each condition in parentheses. Multiply them with * for AND logic, or add them with + for OR logic, for example (C6:C17=”East”)*(F6:F17>=5000).

Why does FILTER return a #CALC! error?

#CALC! appears when no rows match and the optional if_empty argument is missing. Add a value such as “No orders” or “” as the third argument.

Can FILTER use wildcards like * or ?

No. For partial matches, use ISNUMBER(SEARCH(“text”, range)) as the include argument. SEARCH is case-insensitive; use FIND for a case-sensitive match.

Which Excel versions support the FILTER function?

FILTER works in Excel for Microsoft 365, Excel for the web, Excel 2024, and Excel 2021. Excel 2019 and earlier show #NAME? because they lack dynamic arrays.

Download the practice workbook

The same data as this tutorial, with empty answer cells and a Solutions sheet.

Team Xl in Excel

Team Xl in Excel

Spreadsheet Architect & Educator at Xl in Excel. Sharing advanced formulas, dynamic arrays, and clean data modeling techniques.

Learn More About Team Xl in Excel →

Leave a Reply

Your email address will not be published. Required fields are marked *

Zoom: 100% | UTF-8 | Xl in Excel