Excel FILTER Formula: Step-by-Step Guide
In this article
The FILTER function in Excel returns a subset of data that meets criteria you specify, and it does so dynamically—if the source data changes, the filtered result updates automatically. To use it, you need a version of Excel that supports dynamic arrays (Microsoft 365, Excel 2021, or Excel for the web). The basic syntax is =FILTER(array, include, [if_empty]), where array is the range you want to filter, include is a logical test that returns TRUE/FALSE for each row, and if_empty is an optional value to show when no rows match. For example, =FILTER(A2:C10, B2:B10="North", "No results") returns all rows where column B equals "North".
What You'll Need
- Excel for Microsoft 365, Excel 2021, Excel for the web, or Excel for iPad/iPhone (FILTER is not available in Excel 2019 or earlier).
- A data range with consistent columns and no completely blank rows (blank rows can cause unexpected results).
- At least one column to use as a filter criterion.
Step-by-Step
- Select the cell where you want the filtered result to appear. Choose an empty cell with enough space below and to the right—the result will spill into adjacent cells. If the spill range is blocked, you'll see a #SPILL! error.
- Type the FILTER formula. Start with
=FILTER(. The first argument is the range to filter, for exampleA2:D100. Include headers? No—use the data rows only, because headers would be treated as data. - Add the include argument. This is a logical test that returns TRUE or FALSE for each row. For a single condition, use a comparison like
B2:B100="East"orC2:C100>1000. For text, enclose the value in double quotes. For dates, use a date serial or a cell reference. - Add the optional if_empty argument. This is the value to display when no rows match. For example,
"No records found". If you omit it, Excel returns a #CALC! error when nothing matches. - Close the parenthesis and press Enter. The formula will spill results into the cells below and to the right. You'll see a blue outline around the spill range.
- Test the filter. Change a value in the source data that affects the criteria—the spilled results should update automatically. If you see a #VALUE! error, check that your include argument returns an array of TRUE/FALSE values, not a single TRUE/FALSE.
- To filter on multiple conditions, multiply the logical tests. Use
(B2:B100="East")*(C2:C100>500)for AND logic (both must be true). For OR logic, add the tests:(B2:B100="East")+(B2:B100="West"). Wrap each test in parentheses. - To return only specific columns, wrap FILTER inside CHOOSECOLS or INDEX. For example,
=CHOOSECOLS(FILTER(A2:D100, B2:B100="East"), 1, 3)returns only the first and third columns of the filtered rows. Alternatively, use=FILTER(A2:A100, B2:B100="East")for a single column. - To sort the filtered result, wrap FILTER inside SORT. For example,
=SORT(FILTER(A2:D100, B2:B100="East"), 3, 1)sorts by the third column ascending. You can also nest SORTBY for more control. - To use the result in further calculations, refer to the spill range with the # operator. For example,
=SUM(F2#)sums the entire spilled range starting at F2. This is useful for dynamic dashboards.
Common Mistakes
- Forgetting the if_empty argument. If no rows match, Excel returns #CALC!. Always include a fallback like
"None"or"". - Using a single cell instead of a range in the include argument. The include argument must be an array of TRUE/FALSE values the same height as the array. Using
B2="East"instead ofB2:B100="East"will cause a #VALUE! error. - Mismatched array sizes. The array and include arguments must have the same number of rows. If array is A2:D100 (99 rows) and include is B2:B50 (49 rows), you'll get a #VALUE! error.
- Blocked spill range. If there is any non-empty cell in the spill area, you'll see #SPILL!. Clear the cells or move the formula.
- Using FILTER in Excel 2019 or earlier. The function is not available; you'll get #NAME?. Use Advanced Filter or a helper column instead.
- Including headers in the array. If you include the header row, it will be treated as data and may not match your criteria. Start from the first data row.
Tips
- Use cell references for criteria instead of hard-coded values, so you can change the filter without editing the formula. For example,
=FILTER(A2:D100, B2:B100=H1, "No results")where H1 contains the criterion. - For case-insensitive text matching, FILTER is case-insensitive by default. For case-sensitive matching, use EXACT inside the include argument:
EXACT(B2:B100, "East"). - To filter for blanks, use
B2:B100=""; for non-blanks, useB2:B100<>"". - Combine FILTER with UNIQUE to get distinct values:
=UNIQUE(FILTER(A2:A100, B2:B100="East")). - If you need to filter by multiple criteria from a list (e.g., a range of values), use COUNTIF:
=FILTER(A2:D100, COUNTIF(H1:H3, B2:B100)>0, "No results"). - Remember that FILTER returns a dynamic array; you cannot edit individual cells in the spill range. To make static, copy and paste as values.
Troubleshooting
If your FILTER formula returns an error, check these in order:
- #NAME? — Your Excel version does not support FILTER. Check via File > Account > About Excel. If you have Excel 2019 or earlier, use Data > Advanced Filter or a helper column with IF.
- #VALUE! — The include argument is not returning an array of TRUE/FALSE. Ensure you used a range (e.g., B2:B100) and not a single cell. Also check that the array and include ranges have the same number of rows.
- #CALC! — No rows matched and you omitted the if_empty argument. Add a third argument like
"No matches". - #SPILL! — The spill range is blocked. Clear the cells below and to the right of the formula, or move the formula to an empty area.
- Wrong results — Check for leading/trailing spaces in text criteria. Use TRIM in the include argument:
TRIM(B2:B100)="East". Also ensure numbers are not stored as text. - Formula not updating — Ensure calculation is set to Automatic (Formulas > Calculation Options > Automatic). If you copied the formula, check that relative references are correct.
Frequently Asked Questions
Can I use FILTER with multiple criteria?
Yes. For AND logic, multiply the conditions: (B2:B100="East")*(C2:C100>500). For OR logic, add them: (B2:B100="East")+(B2:B100="West"). Wrap each condition in parentheses.
Does FILTER work in Excel 2019?
No, FILTER is only available in Excel for Microsoft 365, Excel 2021, Excel for the web, and Excel for iPad/iPhone. In older versions, use Advanced Filter or a helper column with IF and then filter manually.
How do I filter by a list of values?
Use COUNTIF inside the include argument: =FILTER(A2:D100, COUNTIF(H1:H3, B2:B100)>0, "No results"), where H1:H3 contains the list of values to match.
Can I sort the filtered results?
Yes, wrap FILTER inside SORT: =SORT(FILTER(A2:D100, B2:B100="East"), 3, 1) sorts by the third column ascending. Use SORTBY for more complex sorting.
Why do I get a #SPILL! error?
The spill range is blocked by existing data. Clear the cells below and to the right of the formula, or move the formula to an empty area. Also check for merged cells in the spill range.
Can I use FILTER to return only certain columns?
Yes, use CHOOSECOLS: =CHOOSECOLS(FILTER(A2:D100, B2:B100="East"), 1, 3) returns only the first and third columns. Alternatively, use INDEX to pick columns.