Pick out rows with FILTER

Lists that spill · About 5 minutes

Pick out rows with FILTER

FILTER keeps the rows that pass a test. =FILTER(A2:A9,B2:B9="North") reads as "list the names in A2:A9 where the region in B2:B9 is North". The list spills down.

The test must cover the same rows as the list: A2:A9 with B2:B9, not B2:B8. If nothing passes, FILTER shows #CALC!. A third part says what to show instead: =FILTER(A2:A9,C2:C9>=20,"None"). Google Sheets has no third part (it shows #N/A when nothing passes), so there wrap it in IFERROR: =IFERROR(FILTER(A2:A9,C2:C9>=20),"None").

These work in Excel 365, Excel 2021 or later and Google Sheets. Excel 2016 and 2019 don't have them.

Part of Plus

Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.

What FILTER does

FILTER keeps only the rows that pass a test and lists them somewhere else, like every task longer than 5 hours. The list spills: one formula fills as many cells as it needs.

Unlike a lookup, which finds one match, FILTER gives you all of them. When the data changes, the list updates by itself, so it works well for a live view of open orders or a team's tasks.

How to write FILTER

=FILTER(array, include, [if_empty])

array
The cells to give back, like a column of task names or a whole table.
include
The test for each row, like C2:C8>5. It must cover the same rows as the array.
if_empty
Optional. What to show when no row passes, like "None". In Excel, leaving it out shows a #CALC! error when nothing passes.

FILTER worked example

A team lists its tasks with the hours each one takes. In D2, list the tasks that take more than 5 hours.

A team lists its tasks with the hours each one takes. In D2, list the tasks that take more than 5 hours.
ABCD
1TaskOwnerHoursLong
2PlanLee3Survey
3SurveyKim8Report
4ReportLee6Design
5EmailRavi1
6DesignKim12
7ReviewRavi5
D2=FILTER(A2:A7,C2:C7>5)List the tasks in A2 to A7 where the hours in C2 to C7 are more than 5: Survey, Report and Design spill into D2 to D4. Review takes exactly 5, so it stays out.

Common FILTER mistakes

A #CALC! error, or #N/A in Google Sheets

No row passed the test. In Excel, add a third part, like ,"None". In Google Sheets, which has no third part, wrap the formula in IFERROR.

An error about the size of the ranges

The test covers different rows from the list, like A2:A7 with C2:C6. Make both ranges start and end on the same rows.

A #SPILL! error instead of a list

The cells below the formula aren't empty. Clear them so the list has room. Google Sheets shows #REF! for the same thing.

FILTER or the filter button?

The filter button hides rows in the table itself, which is quick for a one-off look. FILTER leaves the table alone and builds a separate list that updates by itself, which suits a report or a dashboard.

FILTER works in Microsoft 365, Excel 2021 or later and Google Sheets. Older Excel shows #NAME?. In Google Sheets the parts differ a little: it takes extra tests instead of an if_empty part.

Questions people ask

How does the FILTER function work?

=FILTER(A2:A9,B2:B9="North") lists the names in A2:A9 where the region in B2:B9 is North. The list spills down.

Why does FILTER show #CALC!?

No row passed the test. Add a third part for that case: =FILTER(A2:A9,C2:C9>=20,"None").

Why do I get #VALUE! from FILTER?

The test covers different rows from the list, like A2:A9 with B2:B8. Make them the same size.

Is FILTER the same in Google Sheets?

Google Sheets has FILTER too. It takes the list and the test in the same order, but has no third "if empty" part, so wrap it in IFERROR there.

Theme