Home › Excel functions › FILTER
Excel FILTER Function: Filter Formula with Multiple Criteria
FILTER returns all rows from a range that meet a condition, and the result updates automatically when the data changes. Where VLOOKUP and XLOOKUP return one match, FILTER returns every match.
In this guide
FILTER syntax
=FILTER(array, include, [if_empty])| Argument | What it means |
|---|---|
| array | The range to return rows from. |
| include | The condition, written as a comparison on a column, such as A2:A6="North". |
| if_empty (optional) | What to show when no rows match, such as "No results". |
Availability: FILTER works in Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. Older versions show #NAME?.
Comparison operators: what to type
| Type | Means |
|---|---|
| = | is equal to |
| > | greater than |
| < | less than |
| >= | greater than or equal to: first >, then = |
| <= | less than or equal to: first <, then = |
| <> | not equal to: first <, then > |
Always two separate keys, never a special symbol.
Basic example: all sales for one region
| A | B | C | |
|---|---|---|---|
| 1 | Region | Rep | Sales |
| 2 | North | Anna | 1,200 |
| 3 | South | Ben | 800 |
| 4 | North | Chris | 950 |
| 5 | East | Dana | 450 |
| 6 | South | Anna | 700 |
Type this in one cell, say E2, and Excel "spills" the result into the cells below and to the right:
| E | F | G | |
|---|---|---|---|
| 2 | North | Anna | 1,200 |
| 3 | North | Chris | 950 |
Add a new North row to the source and it appears in the result automatically. Put the condition in a cell to make it a dropdown-style report: =FILTER(A2:C6, A2:A6=H1).
FILTER practice: try it yourself
Reading is one thing, typing it is another. Build the formula below step by step: the tips tell you what to type next, and you can click or drag across cells to add them, just like in Excel.
Task: List everyone who works in Sales, starting in D2: =FILTER(A2:A7,B2:B7="Sales")
Multiple criteria: AND and OR
Put each condition in brackets and combine them with * for AND, or + for OR.
- AND: South region and sales above 750:
=FILTER(A2:C6, (A2:A6="South")*(C2:C6>750))returns Ben's 800. - OR: North or East:
=FILTER(A2:C6, (A2:A6="North")+(A2:A6="East"))returns Anna, Chris and Dana.
This works because TRUE counts as 1 and FALSE as 0: multiplying only gives 1 when both are true, adding gives at least 1 when either is.
When nothing matches
If no rows meet the condition, FILTER returns #CALC!. Add the third argument to show a message instead:
Sort, count or sum the results
- Sort the result by sales, highest first:
=SORT(FILTER(A2:C6, A2:A6="North"), 3, -1) - Return only some columns: filter just the reps and sales with
=FILTER(B2:C6, A2:A6="North") - Count the matches:
=ROWS(FILTER(A2:C6, A2:A6="North")) - Unique values from the filtered list: wrap it in UNIQUE.
Filter between two dates or skip empty rows
Dates are numbers in Excel, so you filter them with the same comparisons. With dates in column D, a start date in H1 and an end date in H2:
=FILTER(A2:D100, (D2:D100>=H1)*(D2:D100<=H2), "No results")For one whole month, compare with the first day of that month and the first day of the next: (D2:D100>=H1)*(D2:D100<EDATE(H1, 1)).
Watch out for empty rows in a range like A2:C100. An empty cell counts as 0, so a condition such as C2:C100<500 lets every empty row through, and you get rows of zeros. Add a second condition that the cell is filled in:
Choose columns and show only the top results
In Microsoft 365 and Excel 2024, two extra functions make the result more compact:
- Columns in your own order: CHOOSECOLS picks columns from the result by number.
=CHOOSECOLS(FILTER(A2:C6, C2:C6>750), 3, 1)returns only sales and region for the three rows above 750, sales first. - Only the top rows: sort first, then keep the first rows with TAKE.
=TAKE(SORT(FILTER(A2:C6, A2:A6<>"East"), 3, -1), 2)returns Anna with 1,200 and Chris with 950, the two best rows outside East.
The column numbers count within the range you filter, not the sheet: 1 is the first column of A2:C6, whatever column it is in.
Common errors
- #SPILL!: there's something in the cells where the result wants to go. Clear them.
- #CALC!: nothing matches. Add an
if_emptyvalue. - #VALUE!: the
includerange has a different height thanarray. - #NAME?: your Excel version doesn't have FILTER.
More FILTER examples
Copy a formula and change the ranges to match your own data.
| What you want | Formula |
|---|---|
| All rows where column B equals E1 | =FILTER(A2:C100, B2:B100=E1) |
| AND: E1 and an amount above 100 | =FILTER(A2:C100, (B2:B100=E1)*(C2:C100>100)) |
| OR: E1 or E2 | =FILTER(A2:C100, (B2:B100=E1)+(B2:B100=E2)) |
| Rows where column A contains the text in E1 | =FILTER(A2:C100, ISNUMBER(SEARCH(E1, A2:A100)), "") |
| Filtered and sorted from high to low on column 3 | =SORT(FILTER(A2:C100, C2:C100>100), 3, -1) |
Keep learning
Frequently asked questions
What's the difference between FILTER and the filter button?
The filter button (Data › Filter) hides rows in the original table. The FILTER function creates a separate, live copy of the matching rows somewhere else, leaving the original untouched.
Can FILTER use wildcards?
Not directly. To filter on partial text, use ISNUMBER and SEARCH: =FILTER(A2:C6, ISNUMBER(SEARCH("an", B2:B6))) returns every rep whose name contains "an".
Can FILTER return results from another sheet?
Yes. The ranges can be on any sheet, for example =FILTER(Data!A2:C100, Data!A2:A100="North").
How is FILTER different from XLOOKUP?
XLOOKUP returns the first match. FILTER returns every matching row.
How do I sum the filtered results?
Wrap FILTER in SUM: =SUM(FILTER(C2:C6, A2:A6="North")) returns 2,150. If you only need that one total, SUMIFS does the same and also works in older versions.
How do I filter on a list of values?
Put the values in a few cells, say North and East in H2:H3, and use ISNUMBER with MATCH: =FILTER(A2:C6, ISNUMBER(MATCH(A2:A6, H2:H3, 0))). That gives the same rows as the OR example, but to add a value you only extend the list.
Can FILTER return the result in a row instead of a column?
Yes, wrap it in TRANSPOSE: =TRANSPOSE(FILTER(B2:B6, A2:A6="North")) puts Anna and Chris next to each other in one row.