Excel Power Query: Filter by List (Step-by-Step)
In this article
To filter a Power Query table by a list of values, you don't use the standard filter dropdown. Instead, you add a custom column that checks each row against your list, then filter that column to keep only matches. This is the reliable way to filter by dozens or hundreds of items without manually ticking boxes. You'll need Excel 2016 or later (or Excel 2010/2013 with the Power Query add-in) and a source table plus a separate list of the values you want to keep.
What You'll Need
- Excel with Power Query (Data > Get & Transform Data in modern versions).
- A source table or range you want to filter.
- A list of the values to filter by — either typed into a worksheet range, a separate table, or entered directly in the query.
Step-by-Step
- Load both tables into Power Query. Select your source table and go to Data > From Table/Range. In the Power Query Editor, give the query a clear name (e.g., "SourceData"). Then load your list the same way: select the list range and choose Data > From Table/Range. Name this query something like "FilterList".
- Decide how to match. If your list is short (under about 20 items), you can type the values directly into a formula. For longer lists, keep the FilterList query separate and reference it. The steps below assume a separate list; for a short list, skip to step 4 and type the values as a comma-separated array.
- Convert the list to a single-column table if needed. In the FilterList query, ensure the column containing your values has a clear header (e.g., "KeepValue"). Remove any extra columns so only that one remains. Then close & load this query as a connection only (Close & Load To > Only Create Connection).
- Add a custom column to the source query. Go back to the SourceData query. On the Add Column tab, click Custom Column. In the formula box, enter a formula that checks whether the current row's value appears in the FilterList. For example, if your source column is named "Product" and your list column is "KeepValue", use: . This returns true or false for each row.
- Filter the new column to true. Click the filter arrow on the new custom column and select true (or tick only TRUE). The table now shows only rows whose value exists in your list.
- Clean up and load. Remove the helper custom column if you don't need it (right-click the column header > Remove). Then click Close & Load to send the filtered table to a worksheet or the Data Model.
If your list is short, you can skip the separate query and write the values directly: . This works the same way but keeps everything in one query.
Common Mistakes
- Case sensitivity. List.Contains is case-sensitive by default. "apple" will not match "Apple". Use Comparer.OrdinalIgnoreCase as a third argument if you need case-insensitive matching: .
- Data type mismatches. If your source column is text but the list contains numbers (or vice versa), nothing will match. Ensure both columns have the same data type before comparing.
- Extra spaces. Trailing spaces in either the source or the list will cause missed matches. Trim both columns (Transform > Format > Trim) before filtering.
- Referencing the wrong query name. If you rename the FilterList query later, the formula breaks. Update the reference or avoid renaming.
- Forgetting to refresh. After changing the list, right-click the filtered table and choose Refresh. Power Query does not auto-refresh unless you set it to.
Tips
- Keep the FilterList as a table in the worksheet so you can edit it easily; just refresh the query afterward.
- For very large lists (thousands of items), List.Contains can be slow. Consider merging the queries instead: use Home > Merge Queries and join on the value column, then expand only matching rows.
- Use
Text.Loweron both columns if you want a simple case-insensitive match without the comparer argument. - Name your steps clearly in the Applied Steps pane so you can trace what each filter does.
Troubleshooting
- All rows return false. Check data types, case, and spaces. Also verify the list query actually contains the values you expect — preview it in the Power Query Editor.
- Formula error: "The name 'FilterList' wasn't recognized." The query name is wrong or the list query hasn't been loaded as a connection. Re-check the name in the Queries pane.
- Filter step shows an error for some rows. This often happens when the source column contains nulls. Wrap the comparison with
try ... otherwise falseto handle errors gracefully. - Refresh doesn't pick up new list values. Ensure the list query is set to refresh and that the filtered query depends on it. In Data > Queries & Connections, right-click the filtered query and choose Refresh.
- Performance is slow. For large lists, switch to a merge (as noted in Tips) or load the list into the Data Model and use a relationship.
Frequently Asked Questions
Can I filter by a list stored in another workbook?
Yes. Load that workbook's list as a query (Data > Get Data > From File > From Workbook), then reference it in the custom column formula exactly as you would a local query.
Does List.Contains work with numbers?
Yes, as long as both the list and the source column are numeric. If one is text, convert it first (Transform > Data Type).
How do I filter by a list of partial matches (contains text)?
Use . This checks if the product contains any of the list values as substrings.
Can I use a dynamic list that changes based on another filter?
Not directly in a single step. You would need to create the list query with its own filters, then reference it. The list query will reflect changes after refresh.
What if my list has duplicate values?
List.Contains still works; duplicates don't affect the true/false result. You can remove duplicates from the list query for cleaner data.
Is there a way to filter by a list without adding a custom column?
Yes, you can use Table.SelectRows with a List.Contains condition directly in the formula bar, but the custom column method is easier to audit and edit.