Excel FILTER Function: How to Filter Data
In this article
The FILTER function in Excel returns only the rows that meet a condition, spilling the results into a new range. Use it as =FILTER(array, include, [if_empty]). For example, =FILTER(A2:C100, B2:B100="North", "No results") returns every row where column B equals North. It works in Excel for Microsoft 365, Excel 2021 and later, and Excel for the web; older perpetual versions do not have it.
What You'll Need
- Excel for Microsoft 365, Excel 2021 or later, or Excel for the web. The FILTER function is not available in Excel 2019 or earlier.
- A data range with a single header row and no completely blank rows inside it.
- An empty area of the sheet (or a new sheet) where the results can spill. If cells below or to the right of the formula are occupied, you will get a #SPILL! error.
Step-by-Step
- Lay out your data cleanly. Put one header per column, keep each column to one data type (text, dates, numbers), and remove blank rows. FILTER reads the range you give it, so a tidy block avoids surprises.
- Pick an output cell. Click an empty cell with enough free space below and to the right for the expected results. For example, if you expect up to 50 rows and 3 columns, make sure the 50 rows below and 2 columns to the right are empty.
- Start the formula. Type
=FILTER(and then select the data range including headers only if you want headers in the result. A common pattern is=FILTER(A2:D200, ...)to exclude headers. - Add the include argument. After a comma, write a logical test that returns TRUE or FALSE for each row. Examples:
B2:B200="North"for text,C2:C200>1000for numbers,D2:D200>=DATE(2024,1,1)for dates. The test range must be the same height as the data range. - Combine conditions if needed. Use multiplication for AND and addition for OR. AND:
(B2:B200="North")*(C2:C200>1000). OR:(B2:B200="North")+(B2:B200="South"). Wrap each test in parentheses. - Add the optional if_empty text. After another comma, type a message in quotes, such as
"No matching records". Without it, an empty result shows #CALC!. - Close the parenthesis and press Enter. The results spill automatically. Do not drag the formula down; the spill range handles it. If you see a blue border around the results, the formula is working.
- Reference the spilled range if you need to. Click any cell in the results and note the range shown, or use the
#operator (for exampleG2#) to refer to the whole spill in other formulas.
Menu labels and function behaviour can differ slightly by Excel version and region, but the FILTER syntax is the same across supported platforms.
Common Mistakes
- Mismatched range sizes. If the array is A2:D200 but the include test is B2:B100, Excel returns #VALUE!. Keep every range the same height.
- Forgetting parentheses around combined tests.
B2:B200="North"*C2:C200>1000does not work as intended. Write(B2:B200="North")*(C2:C200>1000). - Blocked spill area. Any existing value in the spill range causes #SPILL!. Clear the cells or move the formula.
- Using text without quotes. Criteria like North must be in double quotes:
"North". Cell references do not need quotes:B2:B200=H1. - Expecting FILTER in older Excel. Excel 2019 and earlier show #NAME?. Use AutoFilter or Advanced Filter there instead.
- Hard-coding a fixed output range. FILTER spills dynamically; copying it down as a legacy array formula defeats the purpose and can produce duplicate results.
Tips
- Use a cell reference for criteria so users can change the filter without editing the formula: put North in H1 and use
B2:B200=H1. - For case-insensitive partial matches, combine SEARCH or ISNUMBER:
ISNUMBER(SEARCH("north",B2:B200)). - Sort the output with SORT:
=SORT(FILTER(A2:D200,B2:B200="North"),3,-1)sorts by the third column descending. - Return only specific columns by nesting CHOOSECOLS or by referencing non-adjacent columns inside FILTER where your version supports it.
- Convert the source range to an Excel Table (Insert > Table) and use structured references so the formula expands as rows are added.
- If you need the results in another app, copy the spill range and paste as values to freeze the output.
Troubleshooting
- #SPILL! error: The output area is not empty. Select the cells in the spill range and clear them, or move the formula to an empty area.
- #CALC! error: The filter returned no rows and no if_empty argument was supplied. Add a message such as
"None"as the third argument. - #VALUE! error: Range sizes do not match, or a logical test is malformed. Check that array and include ranges have the same number of rows.
- #NAME? error: The function is not recognised. Confirm you are on Excel 2021 or Microsoft 365, and that the name is spelled FILTER.
- Wrong rows returned: Check for leading or trailing spaces in text criteria, and confirm numbers are stored as numbers, not text. Use TRIM or VALUE where needed.
- Formula worked, then broke after rows were added: The source range was fixed. Convert the data to a Table and use structured references, or extend the range manually.
Frequently Asked Questions
Does FILTER work in Excel 2019?
No. FILTER is available in Excel for Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. In Excel 2019 and earlier, use AutoFilter, Advanced Filter, or a helper column with IF and sorting.
Can I filter by more than one condition?
Yes. Multiply conditions for AND and add them for OR, wrapping each test in parentheses. For example, (B2:B200="North")*(C2:C200>1000) returns rows that are both North and over 1000.
Why do I get #SPILL! instead of results?
The formula needs empty cells for all results. Something is blocking the spill range below or beside the formula. Clear those cells or move the formula to an empty area.
Can FILTER return only some columns?
Yes. Wrap the array in CHOOSECOLS, for example =CHOOSECOLS(FILTER(A2:D200,B2:B200="North"),1,3), to return only the first and third columns. CHOOSECOLS requires a version that supports it.
Does FILTER update automatically when data changes?
Yes. The formula recalculates when the source data changes, and the spill range grows or shrinks to fit the new results, provided the spill area remains clear.
Can I use FILTER with dates?
Yes. Compare against a date or DATE function, for example D2:D200>=DATE(2024,1,1). Ensure the date column contains real dates, not text.