ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dynamic arrays
  3. How to Filter by a List of Values in Excel

How to Filter by a List of Values in Excel

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

To filter by a list in Excel, use FILTER with COUNTIF as the test: =FILTER(A2:C9,COUNTIF(E2:E3,B2:B9)) returns every row whose region appears in the list in E2:E3. COUNTIF gives a count for each row, and any count above zero keeps it. Use =0 to exclude the list instead. In older Excel, use Advanced Filter.

Key takeaways

  • =FILTER(data,COUNTIF(list,column)) keeps rows whose value is on the list; add =0 to remove them instead.
  • ISNUMBER(MATCH(column,list,0)) is an equal alternative to COUNTIF inside FILTER.
  • Put the list in an Excel table so new values are included without editing the formula.
  • FILTER needs Excel 2021 or Microsoft 365; older versions can use Advanced Filter or a COUNTIF helper column.
  • Matches are not case-sensitive, but stray spaces and numbers stored as text stop a match.
On this page+
  1. How to filter by a list with FILTER and COUNTIF
  2. The ISNUMBER and MATCH alternative
  3. How to exclude a list of values
  4. Combine the list with other conditions
  5. Make the list grow automatically
  6. Filter by a list in older Excel
  7. Why filter by list returns the wrong rows
  8. Practise it

To filter by a list in Excel, you need rows whose value matches any item on a separate list: these five product codes, those three regions, the customers on a watch list. Typing one OR condition per item gets long fast. Instead, give FILTER a COUNTIF test that checks every row against the whole list at once. This guide shows that formula, how to exclude a list, and options for older Excel.

All the examples use this sales table in A1:C9, with the regions to keep listed in E2:E3:

ABCDE
1CustomerRegionAmountKeep
2AcmeNorth500North
3BoltSouth300East
4CoraEast250
5DynaWest400
6ElanNorth150
7FinoSouth600
8GalaEast350
9HartWest200

How to filter by a list with FILTER and COUNTIF#

Use COUNTIF as FILTER's test, with the list as the range and the data column as the criteria:

Excel formula
=FILTER(A2:C9,COUNTIF(E2:E3,B2:B9))

The result spills four rows: Acme, Cora, Elan and Gala, the North and East customers. Here is how it works:

  1. COUNTIF(E2:E3,B2:B9) asks, for each region in B2:B9, "how many times is this on the Keep list?" It returns one number per row: 1, 0, 1, 0, 1, 0, 1, 0.
  2. FILTER treats any non-zero number as TRUE and 0 as FALSE.
  3. FILTER returns the rows of A2:C9 where the test is TRUE.

Notice the order: the list goes first in COUNTIF, and the data column goes second. Swap them and you get the wrong counts. FILTER needs Excel 2021 or Microsoft 365. The FILTER function guide and the COUNTIF function guide cover each function on its own, and the article on the FILTER function with AND and OR explains the basics.

The ISNUMBER and MATCH alternative#

ISNUMBER with MATCH does the same job and some people find it easier to read:

Excel formula
=FILTER(A2:C9,ISNUMBER(MATCH(B2:B9,E2:E3,0)))

MATCH looks for each region in the list and returns its position, such as 1 or 2, or #N/A when it isn't there. ISNUMBER turns positions into TRUE and #N/A into FALSE. The result is the same four rows. Here the data column comes first, because MATCH asks "where is this value in the list?". In Microsoft 365, XMATCH works too: ISNUMBER(XMATCH(B2:B9,E2:E3)). The ISNUMBER function guide explains why it is so useful for turning errors into FALSE.

Use whichever you prefer. COUNTIF is a little shorter; MATCH reads more like plain English.

How to exclude a list of values#

To remove the rows on the list and keep everything else, test for a count of zero:

Excel formula
=FILTER(A2:C9,COUNTIF(E2:E3,B2:B9)=0)

This returns Bolt, Dyna, Fino and Hart: the South and West customers. The MATCH version is =FILTER(A2:C9,NOT(ISNUMBER(MATCH(B2:B9,E2:E3,0)))). Exclusion lists are handy for removing test accounts, internal emails or cancelled orders.

Combine the list with other conditions#

Multiply the list test by another condition to require both. To keep North and East customers with amounts of 300 or more:

Excel formula
=FILTER(A2:C9,(COUNTIF(E2:E3,B2:B9)>0)*(C2:C9>=300))

The result is Acme (500) and Gala (350). The >0 turns the counts into TRUE or FALSE before multiplying, which keeps the test clean even if a value appears twice on the list. The guide to FILTER with multiple criteria explains how * means AND and + means OR. For partial text matches instead of a list, see how to filter rows that contain text.

To total the matching rows instead of listing them, wrap the result: =SUM(FILTER(C2:C9,COUNTIF(E2:E3,B2:B9))) returns 1,250.

Make the list grow automatically#

Turn the list into an Excel table so the formula picks up new values. Select E1:E3, press Ctrl+T (Mac: ⌘T) and name the table Keep. Then write:

Excel formula
=FILTER(A2:C9,COUNTIF(Keep[Keep],B2:B9))

Type "South" under the table and the filter result updates at once. Add a third argument to show a message when nothing matches: =FILTER(A2:C9,COUNTIF(E2:E3,B2:B9),"No matches"). Without it, an empty result shows #CALC!.

Filter by a list in older Excel#

Without FILTER, you have two good options:

Advanced Filter#

  1. Give the list the same header as the data column: change E1 from "Keep" to Region.
  2. Click inside the data and choose Data > Advanced (in the Sort & Filter group).
  3. Set the List range to A1:C9 and the Criteria range to E1:E3.
  4. Choose Copy to another location if you want the result elsewhere, then click OK.

Advanced Filter treats each row of the criteria range as an OR condition. It doesn't update by itself, so run it again when the data changes.

A COUNTIF helper column#

Add a column D with =COUNTIF($E$2:$E$3,B2)>0 and fill it down. Then turn on the filter buttons (Windows: Ctrl+Shift+L; Mac: ⌘⇧F) and filter column D for TRUE. This works in every version of Excel and is easy to check.

Why filter by list returns the wrong rows#

When rows are missing, the values don't match exactly. Check these:

  1. Extra spaces. "North " with a trailing space doesn't match "North". Clean both sides with TRIM.
  2. Numbers stored as text. Product code 1050 as a number doesn't match "1050" as text. Make both the same type.
  3. Arguments swapped. In COUNTIF the list comes first; in MATCH the data column comes first.
  4. Ranges of different heights. The test range (B2:B9) must have as many rows as the data (A2:C9), or FILTER shows #VALUE!.

Matching is not case-sensitive, so "north" matches "North". To show the matches as one comma-separated cell instead of rows, see how to list matches in one cell.

Practise it#

Filtering by a list combines two skills: FILTER for returning rows, and COUNTIF for testing each row. Practise the FILTER function in a live spreadsheet, then practise COUNTIF to get comfortable with ranges and criteria. Each lesson checks your formula instantly. Then try the exercise on this page to filter the sales table by the Keep list.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Show only the customers in the regions listed in E2:E3. In G2, type =FILTER(A2:C9,COUNTIF(E2:E3,B2:B9)) and press Enter.

fx
ABCDEFGH
1
Customer
Region
Amount
Keep
2
Acme
North
500
North
3
Bolt
South
300
East
4
Cora
East
250
5
Dyna
West
400
6
Elan
North
150
7
Fino
South
600
8
Gala
East
350
9
Hart
West
200
10
11
12

Tip: FILTER needs the rows to return (A2:C9) and a test. COUNTIF(E2:E3,B2:B9) counts each region in the Keep list, and any count above 0 keeps the row. Four rows spill: Acme, Cora, Elan and Gala.

Practise this in a lesson

LessonFILTER: pull matching rows with a formulaReturn every row that meets one or more conditions with FILTER, and show a friendly message when nothing matches.LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".Function guideFILTERReturn every row that matches a condition with Excel's FILTER. Multiple criteria, empty results and #SPILL! explained, with live practice.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.Function guideISNUMBERUse ISNUMBER to catch numbers stored as text and, with SEARCH, to test whether a cell contains a word. Examples, pitfalls and live practice.

Frequently asked questions

How do I filter a table by a list of values in Excel?

+

Use =FILTER(data,COUNTIF(list,column)), where list is the cells holding the values you want and column is the matching column of the data. Every row whose value is on the list is returned.

How do I exclude a list of values with FILTER?

+

Compare the COUNTIF result with zero: =FILTER(A2:C9,COUNTIF(E2:E3,B2:B9)=0). Rows whose value is not on the list are returned.

Can I filter by a list without the FILTER function?

+

Yes. Use Data > Advanced with your list as the criteria range, or add a helper column with =COUNTIF(list,B2)>0 and filter that column for TRUE with the normal filter buttons.

Why does FILTER by list return #CALC!?

+

#CALC! means nothing matched, so FILTER had no rows to return. Add a third argument, such as "No matches", or check the list for spaces and typos.

Is filtering by a list case-sensitive?

+

No. COUNTIF and MATCH ignore capitals, so north on the list matches North in the data. Spaces do matter, so clean both sides with TRIM if rows are missing.

Sources

  • FILTER function - Microsoft Support
  • COUNTIF function - Microsoft Support
  • Filter data in a range or table - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to filter by a list with FILTER and COUNTIF
  2. The ISNUMBER and MATCH alternative
  3. How to exclude a list of values
  4. Combine the list with other conditions
  5. Make the list grow automatically
  6. Filter by a list in older Excel
  7. Why filter by list returns the wrong rows
  8. Practise it

Keep reading

Dynamic arrays· 7 min read

List All Matching Values in One Cell

To list all matching values in one cell in Excel, wrap FILTER in TEXTJOIN: =TEXTJOIN(", ",TRUE,FILTER(A2:A8,B2:B8="Sales")). FILTER finds every row that matches, and TEXTJOIN joins the results with a comma and a space. This needs Excel 2021 or Microsoft 365. In Excel 2019, use IF inside TEXTJOIN instead.

Dynamic arrays· 6 min read

The FILTER Function in Excel (With AND and OR)

FILTER returns every row of a range that passes a test: =FILTER(A2:C9,B2:B9="East"). The matching rows spill into the cells below and update when the data changes. For AND, multiply tests in brackets; for OR, add them. The third argument shows a message when nothing matches. FILTER needs Excel 2021, Excel 2024 or Microsoft 365.

Dynamic arrays· 6 min read

FILTER With Multiple Criteria: AND and OR

To use the FILTER function with multiple criteria, put each condition in brackets and combine them. Multiply for AND: =FILTER(A2:D8,(B2:B8="East")*(C2:C8="Laptop")). Add for OR: =FILTER(A2:D8,(B2:B8="East")+(B2:B8="West")). Mix them with extra brackets. Don't use the AND and OR functions inside FILTER, because they return one result, not one per row.

More on dynamic arrays

  • FILTER Rows That Contain Text in Excel
  • Filter Out Blanks in Excel With the FILTER Function
  • FILTER Specific Columns in Excel (Not the Whole Row)
  • UNIQUE With Criteria: List Distinct Values That Match
  • Excel GROUPBY Function: Pivot-Style Summaries With a Formula
  • LAMBDA Function in Excel: Write Your Own Functions
All dynamic arrays articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free