Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

FILTER Function in Excel: Examples with AND, OR and Sorting

FILTER function in Excel with examples
Illustration: FILTER function in Excel

The FILTER function in Excel returns only the rows of a table that meet your condition, and the result updates when the data changes. You write one formula and Excel spills all the matching rows into the cells below. This guide shows FILTER examples with made-up data: one condition, two conditions with AND and OR, a message when nothing matches, a sorted result and the errors to watch for.

FILTER is available in Excel for Microsoft 365 and Excel 2021 or later. It is not in Excel 2019 or older. Google Sheets has its own version, covered in FILTER function examples for Google Sheets.

FILTER syntax

=FILTER(array, include, [if_empty])

  • array is the data you want back, for example a whole table.
  • include is a test that gives TRUE or FALSE for each row.
  • if_empty is optional. It is the value to show when no row matches.

Basic example: one condition

Say A2:C10 holds Name, Region and Sales. To list only the rows where the region is North:

=FILTER(A2:C10, B2:B10="North")

The result spills across three columns and as many rows as match. Keep the cells below and to the right of the formula empty.

FILTER function in Excel with one condition: North region
Made-up sales table (illustration).

Filter by a number

To list the rows with sales above 100:

=FILTER(A2:C10, C2:C10>100)

When the limit is in a cell such as F1, write C2:C10>F1.

Two conditions with AND

Multiply the tests. A row is kept only when both are true:

=FILTER(A2:C10, (B2:B10="North")*(C2:C10>100))

FILTER function in Excel with AND and OR conditions
Multiply for AND, add for OR (illustration).

Two conditions with OR

Add the tests. A row is kept when at least one is true:

=FILTER(A2:C10, (B2:B10="North")+(B2:B10="South"))

Show a message when nothing matches

Without the third argument, FILTER returns a #CALC! error when no row matches. Add a message:

=FILTER(A2:C10, B2:B10="East", "No matches")

FILTER function in Excel with a No matches message
Avoid the CALC error (illustration).

Sort the filtered result

Wrap FILTER in SORT to order the rows. To sort by the third column from largest to smallest:

=SORT(FILTER(A2:C10, B2:B10="North"), 3, -1)

The 3 is the column number inside the result, and -1 means descending.

SORT and FILTER together in Excel to sort the result
Order the filtered rows (illustration).

Return only some columns

To get only some columns, wrap FILTER in CHOOSECOLS and name the columns you want. For the name and the sales:

=CHOOSECOLS(FILTER(A2:C10, B2:B10="North"), 1, 3)

CHOOSECOLS is only in current Microsoft 365 versions, so check yours first. On older versions, filter a block that holds just the columns you need.

Filter text that contains a word

Use ISNUMBER with SEARCH for a partial match:

=FILTER(A2:C10, ISNUMBER(SEARCH("desk", A2:A10)))

Use FILTER for lookups

FILTER can return every match, which VLOOKUP and XLOOKUP cannot. Use it when a value appears in several rows. For a single match, XLOOKUP is simpler.

Common FILTER errors

  • #SPILL! Something blocks the result area. Clear the cells below and to the right.
  • #CALC! No row matched and you left out the if_empty argument.
  • #VALUE! The include range has a different number of rows from the array.
  • #NAME? Your Excel version does not have FILTER.

If duplicates appear in your result, combine FILTER with UNIQUE. See how to remove duplicates in Excel.

Questions and answers

Does FILTER change my original data?

No. It only displays the matching rows in another place.

What is the difference between FILTER and the Filter button?

The Filter button on the Data tab hides rows in the table itself. The FILTER function creates a separate live list and leaves the table as it is.

Can I filter across sheets?

Yes. Reference the ranges on the other sheet, for example Data!A2:C100.

Why is the result not updating?

Check that calculation is set to Automatic in the Formulas tab.

Summary

Use FILTER with one range and one test, multiply tests for AND, add them for OR, add a message for empty results and wrap it in SORT when you need an order.

العربية