How to use the FILTER function in Excel (multiple criteria, examples)
FILTER pulls the rows that meet a condition out of a table and returns them in another place. When the source data changes, the result updates itself.
Syntax
=FILTER(array, include, [if_empty])
- array — The range to return: a single column or a whole table (for example A2:D100).
- include — An expression that produces a TRUE/FALSE array, e.g. B2:B100="Tashkent". It must have the same number of rows as array.
- if_empty — Optional. The value to return when nothing matches, e.g. "Not found". Without it you get a #CALC! error.
Example
Formula:
=FILTER(A2:A5,(B2:B5="Tashkent")*(C2:C5>100000))→ result: Aziz
How FILTER works
FILTER tests the condition for every row of the array and returns only the rows where it is TRUE. The example has two conditions: the region is Tashkent AND sales are above 100,000. Jasur is also from Tashkent but sold 95,000; Malika sold more but works in Bukhara. So only Aziz is returned. You type the formula in one cell, and the result “spills” down and to the right into as many cells as it needs. This is called a dynamic array.
Multiple criteria: * for AND, + for OR
The AND and OR functions don’t work inside FILTER (they return a single answer for the whole range). Instead, wrap each condition in parentheses and combine them with arithmetic: • AND (both must be true): =FILTER(A2:C100,(B2:B100="Tashkent")*(C2:C100>100000)) • OR (at least one): =FILTER(A2:C100,(B2:B100="Tashkent")+(B2:B100="Samarkand")) • Date range: =FILTER(A2:C100,(A2:A100>=F1)*(A2:A100<=F2)) • Text contains a word: =FILTER(A2:C100,ISNUMBER(SEARCH("notebook",B2:B100))) Don’t forget the parentheses around each condition — without them the order of operations breaks.
Empty result: #CALC! and the third argument
If no row matches, FILTER returns a #CALC! error. Use the third argument to show your own message: =FILTER(A2:C100,B2:B100=F1,"No sales for this region") Inside a calculation it is handier to return 0: =SUM(FILTER(C2:C100,B2:B100=F1,0)).
#SPILL! error: no room for the result
A FILTER result takes up several cells. If any of them contains something — even a space — the formula returns #SPILL!. Click the error cell: Excel draws a dashed border around the blocking cells so you can clear them. Two other causes: the formula sits inside an Excel table (Ctrl+T), where spilling isn’t allowed; or the result would run past the edge of the sheet (for example, filtering the whole column A:A with the formula below row 2).
Sorting and picking columns
You can pass the FILTER result to other dynamic array functions: • Sorted by sales, largest first: =SORT(FILTER(A2:C100,B2:B100="Tashkent"),3,-1) • Only columns 1 and 3 (Excel 365/2024): =CHOOSECOLS(FILTER(A2:D100,B2:B100="Tashkent"),1,3) • Number of matching rows: =ROWS(FILTER(A2:A100,B2:B100="Tashkent")) • Conditional total: =SUM(FILTER(C2:C100,B2:B100="Tashkent")) To refer to a whole spilled result, add # after its first cell: =COUNTA(F2#).
FILTER function vs AutoFilter (Ctrl+Shift+L)
AutoFilter (Data → Filter or Ctrl+Shift+L) hides rows in the original table: great for a quick look, but you pick the condition by hand every time. The FILTER function leaves the source untouched, returns the result somewhere else (even on another sheet) and updates automatically when the data changes. Put the condition in a cell (say, a region chosen from a drop-down list in F1) and you get an interactive report. Rule of thumb: a one-off look — AutoFilter; a permanent report or dashboard — FILTER.
Versions and limitations
• FILTER exists only in Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. In Excel 2016/2019 the formula returns #NAME? — use AutoFilter or Advanced Filter there. • You can’t edit a single cell of a spilled result — only the formula in the first cell. • The include range must have as many rows as the array, otherwise you get #VALUE!. • If the data keeps growing, use a range with spare rows (A2:C1000) or turn the source into a table with Ctrl+T.
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.