FILTER
Pull specific rows from a range based on conditions you define, returning a dynamic array of matching results.
Spreadsheet editor
Spreadsheet editor
Syntax
=FILTER(array, include, [if_empty])
Returns: Array Arguments
| Argument | Required | Description |
|---|---|---|
| array | Yes | The range or array you want to filter. |
| include | Yes | A Boolean array the same height (or width) as the array. Rows where this evaluates to TRUE are included in the results. |
| if_empty | No | The value to return when no rows match. Without this, Excel returns a #CALC! error if nothing qualifies. |
About
FILTER really shines when you combine it with other dynamic array functions. Wrap it in SORT to order the results, or pass its output to UNIQUE to remove duplicates. You can also apply multiple conditions at once: multiply conditions together for AND logic, or add them for OR logic.
Because the results update automatically when your source data changes, FILTER is a great replacement for manual filtering or complex INDEX/MATCH lookups. Just keep in mind that if no rows match, Excel returns a #CALC! error unless you provide the optional if_empty argument.
Exercises using FILTER
Examples
Handling zero matches with if_empty
Spreadsheet editor
AND logic with multiple conditions
Spreadsheet editor
FILTER + SORT for ordered results
Spreadsheet editor
Watch out for
#CALC! error with no matches
When no rows satisfy the condition and you haven't supplied the if_empty argument, Excel returns a #CALC! error.
→ Always provide the third argument, even if it is just an empty string (""), to handle the case where nothing matches.
Mismatched array sizes
The include array has a different number of rows (or columns) than the source array, causing an error.
→ Make sure the include range covers exactly the same number of rows as the array argument. For example, if your data is A2:D50, the condition range should also span 49 rows (like B2:B50).
Errors inside the include array
If any cell in the include range contains an error (such as #N/A or #VALUE!), the entire FILTER formula returns that error.
→ Clean up errors in the condition range first, or wrap the condition in IFERROR to convert errors to FALSE before passing them to FILTER.