formulastreak

Dynamic arrays function

FILTER function in Google Sheets and Excel

FILTER returns every row of a range that meets a condition, spilled into the cells below.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

FILTER(array, include, [if_empty])

Arguments in [brackets] are optional. Google Sheets writes it FILTER(range, condition1, [condition2]).

Example

=FILTER(A2:A9,B2:B9="North") reads: Return the names A2:A9 of every rep whose region B2:B9 is North.

Q3 sales team · edit H2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultH2 = Amara Osei
ABCDEFGH
1RepRegionJulAugSepTargetNorth reps
2Amara OseiNorth$12,400$13,100$11,800$36,000Amara Osei
3Ben FischerSouth$9,800$10,250$12,100$30,000Eva Novak
4Lina ChenEast$15,200$14,800$16,900$45,000
5Diego AlvarezWest$8,700$9,100$8,400$28,000
6Eva NovakNorth$11,200$12,600$13,900$36,000
7Farid HaddadSouth$13,300$12,900$14,100$39,000
8Grace KimEast$10,100$9,600$10,800$33,000
9Hugo MartinWest$14,500$15,800$15,100$42,000

H2 and H3 show Amara Osei and Eva Novak: the two North reps. One formula filled two cells.

How the spreadsheet calculates it

Keeps the rows of A2:A9 where B2:B9 is equal to "North", and spills them into the cells below. If nothing matches, Excel shows #CALC!.

  1. 1. FILTER: Keeps the rows of A2:A9 where B2:B9 is equal to "North", and spills them into the cells below. If nothing matches, Excel shows #CALC!.
    • array = `A2:A9`: what to return
    • include = `B2:B9="North"`: a TRUE/FALSE test per row

More FILTER examples

  • =FILTER(A2:A9,B2:B9="North")Every North rep.
  • =FILTER(A2:E9,(B2:B9="South")*(E2:E9>12000))Whole rows for South reps over 12,000 in September.
  • =FILTER(A2:A9,(B2:B9="North")+(B2:B9="East"))Reps in the North or the East.
  • =SORT(FILTER(A2:C9,C2:C9>10000),3,-1)Matching rows, sorted by the third column, highest first.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Always give the third argument in Excel when “no matches” is possible, so dependent formulas don't inherit #CALC!.
  • Leave empty space below a FILTER for the result to grow into.
  • Build complex conditions in a helper column first to check them, then move them into include.
  • Multiply conditions for AND and add them for OR; AND() and OR() return one value for the whole range.

What FILTER is used for

Live lists that update themselves: open tickets for one agent, orders over a threshold, everyone in one department, without copying or re-filtering by hand.

Arguments

ArgumentRequiredWhat it is
arrayYesThe range to filter: one column or whole rows.
includeYesA TRUE/FALSE column as tall as array, like B2:B9="North". Multiply conditions for AND, add them for OR.Watch out: A different height returns an error.
if_emptyNoWhat to show when no row matches, instead of #CALC!.

Common mistakes

  • Typing in the cells the result needs: #SPILL!.

  • A condition range of a different height from the array.

  • Using AND() or OR() inside include: they return one value, not one per row.

  • Typing in the cells the result needs, which gives #SPILL!.

In Google Sheets

Google Sheets' FILTER takes extra conditions as extra arguments and has no if_empty: when nothing matches it returns #N/A, so wrap it in IFNA.

Errors you may see with FILTER

Questions

Which versions have FILTER?

Excel 2021, Excel 2024, Microsoft 365 and Google Sheets. See the FILTER guide for older versions.

How do I count what FILTER returns?

ROWS(FILTER(…)), or COUNTIFS with the same conditions.

Can FILTER return only some columns?

Give it only those columns as the array, like FILTER(A2:A9, …) for names. For columns that aren't next to each other, write one FILTER per column with the same include, side by side.

Sources

Official documentation the facts on this page were checked against.

Practise FILTER on a live sheet

Lesson 38, FILTER (Unit 11, Dynamic arrays), has 7 graded exercises, checked instantly, with steps and hints when you're stuck. Pro