FxFormula Drills

FILTER vs Advanced Filter

Use the FILTER function when you want a live list or a total of the rows that pass a test. It spills the matching values and recalculates when the source changes. It needs Excel 2021, Microsoft 365, or Google Sheets. Advanced Filter is the Data-tab command in Excel, including versions that have no FILTER function. It copies or hides rows once. It does not recalculate until you run it again.

Syntax

FILTER

FILTER(array, include, [if_empty])

array is the range to return. include is a TRUE/FALSE test for each row, the same height as array. if_empty is what to return when no row passes. The result spills.

Advanced Filter

Data > Advanced (a command, not a function)

You point it at a list range and a criteria range. The criteria range repeats the column headers. Criteria on the same row are AND. Criteria on different rows are OR. Copy to another place, or filter the list in place. There is no formula to copy.

SUMIF, when you only need the total

SUMIF(range, criteria, sum_range)

If you do not need the matching rows themselves, SUMIF or SUMIFS returns the total without a spill. That works in older Excel too.

Comparison

QuestionFILTERAdvanced FilterSUMIF
What it isA functionA ribbon commandA function
Updates when source data changesYesNo. Run it againYes
Returns the rowsSpills themCopies them or hides the othersNo. It returns a total
AND and ORMultiply tests for AND. Add tests for ORSame row is AND. Next row is OROne test. SUMIFS for AND
No match#CALC! unless you pass if_emptyThe destination stays empty0
VersionsExcel 2021, Microsoft 365, Google SheetsDesktop Excel, including older versionsCurrent and older Excel, Google Sheets

Worked examples

East amounts, spilled and summed

The include test A2:A5="East" is true on three rows. FILTER spills those amounts. SUM around FILTER adds them without leaving the list on the sheet. SUMIF does only the total.

East 10, West 40, East 30, East 20.
RowABC
1RegionProductAmount
2EastPen10
3WestPen40
4EastBook30
5EastPen20
  • =FILTER(C2:C5,A2:A5="East") → 10
  • E3 spilled → 30
  • E4 spilled → 20
  • =SUM(FILTER(C2:C5,A2:A5="East")) → 60
  • =SUMIF(A2:A5,"East",C2:C5) → 60

The spill is 10, then 30, then 20, in that order, which is the order the East rows appear. The West 40 is not in the spill. The sum of the spill is 60, the same figure SUMIF returns. In a graded drill, SUM of FILTER fits in one cell. The spill itself needs empty cells underneath the formula.

A region that is not in the list

South matches nothing. Without a third argument, FILTER has no rows to return. The third argument is the value to show instead.

No South rows.
RowABC
1RegionProductAmount
2EastPen10
3WestPen40
4EastBook30
5EastPen20
  • =FILTER(C2:C5,A2:A5="South","None") → None

if_empty is used only when the include test is false for every row. It is not a substitute for IFERROR. A mistake in the formula, such as ranges of different heights, is still an error.

When to use which

Use FILTER to build a live subset

A list of this month's open orders, or the East amounts under a heading, should be a formula so the next refresh does not depend on someone re-running a command. Excel 2021, Microsoft 365, and Google Sheets can do that.

Use Advanced Filter on older desktop Excel, or for a one-time extract

Set up a criteria range with the same headers as the list. Put East under Region to keep East rows. Put East under Region and Pen under Product on that same criteria row to require both. Put West on the next criteria row to add West as OR. Copy the result to a destination. It will not follow later edits until you run Advanced Filter again.

Use SUMIF or SUMIFS when the rows themselves are not the deliverable

A dashboard total does not need a spill. SUMIF is shorter, and it runs in workbooks that have never heard of FILTER. The East total in the example is 60 either way.

Common mistakes

Include range taller or shorter than the array

FILTER(C2:C5, A2:A4="East") does not pair the last amount with a test. The include argument has to be one TRUE or FALSE per row of the array.

Blocking the spill

If E3 already contains a label, the FILTER in E2 cannot spill and Excel shows #SPILL!. Clear the cells the result needs, or wrap FILTER in SUM when you only wanted the total.

Writing AND as a word inside FILTER

Two tests are multiplied: (A2:A5="East")*(B2:B5="Pen"). That product is the include argument. There is no AND keyword between the comparisons.

Expecting Advanced Filter to be a formula

You cannot type =ADVANCEDFILTER. The command uses a criteria range. People sometimes rebuild that criteria range by hand and forget that same-row criteria are AND.

Versions and compatibility

FILTER is in Excel 2021, Excel 2024, Microsoft 365, Excel for the web, and Google Sheets. It is not in Excel 2019 or earlier. There the formula returns #NAME?.

Advanced Filter is a desktop Excel feature on the Data tab. Google Sheets does not have that dialog. Google Sheets has filter views and the FILTER function. A criteria range you built for Advanced Filter does not run itself in Google Sheets.

When no row matches and you omit if_empty, Excel's FILTER returns #CALC!. The example passes "None" so the result is a label instead. SUMIF of a miss returns 0, which is a different answer to a different question.

Practice on Formula Drills

Free drills are open with no account. Premium drills show the problem to everyone and grade the sheet for subscribers.

Free exercises

Premium exercises

Function pages

FAQ

How do I filter with AND and OR?

AND is multiplication of the tests. OR is addition of the tests. (A2:A5="East")*(B2:B5="Pen") keeps East Pens. (B2:B5="Pen")+(B2:B5="Book") keeps either product. Do not add tests that can both be true for one row unless you want that row once for each hit. Use parentheses.

Can FILTER return several columns?

Yes. The array can be A2:C5, and the include test still has one value per row. The spill is then as wide as the array. SUM of that spill would add text as well as numbers, so sum a single amount column when the total is the goal.

What is the criteria range for Advanced Filter?

Copy the headers you want to test into a blank area. Type the required values on the row under those headers. East under Region and Pen under Product, same row, means both. A second row of criteria is another acceptable combination.

Why does the drill use SUM(FILTER(...))?

The East sales drill grades one cell. SUM collapses the spill into the total 60, which is the figure the drill checks. The matching amounts are still what FILTER selected.