Power Query Problems

How to Filter Power Query Text by a List of Partial Keywords in Excel

Amos GikundaAmos Gikunda Nov 10, 2026 869 views

Question details

The user needs to filter a large dataset of text rows against an editable list of partial keywords to match text variations.

How to Filter Power Query Text by a List of Partial Keywords
Product
Microsoft Excel
Device & OS
not provided
Scenario
Matching various naming conventions, spellings, and abbreviations (e.g., Amzn US, Amazon Germany, Bosch, BSH) against a large dataset without writing hundreds of individual filter rules.
Observed behavior
The user wants a query output that returns only the rows containing at least one of the defined partial keywords from the list.
Before you start

Ensure that both your main dataset and your keyword list are formatted as official Excel Tables before loading them into the Power Query Editor.

Solution 1Recommended

Use Text.Contains for Explicit Partial Matching

This is the most accurate method to check if any text string contains at least one keyword from your predefined list.

By utilizing the Text.Contains function wrapped inside a List.AnyTrue function, Power Query iterates through your keyword list for every row in your main dataset.

To prevent capitalization mismatches, it is highly recommended to add the Comparer.OrdinalIgnoreCase parameter.

1
Load your tables into Power Query

Select your main data table, go to the 'Data' tab on the ribbon, and click 'From Table/Range'. Repeat this step for your keyword list table. Ensure your keyword query is loaded as a List (right-click the keyword column header and select 'Drill Down').

2
Add a Custom Column

In your main data query, go to 'Add Column' > 'Custom Column'. Name the column 'KeywordMatch'.

3
Write the M-code formula

In the custom column formula box, enter: List.AnyTrue(List.Transform(KeywordList, each Text.Contains([YourTextColumn], _, Comparer.OrdinalIgnoreCase))). Replace 'KeywordList' with the name of your keyword query and 'YourTextColumn' with the name of your data column.

4
Filter the results

The new custom column will output 'TRUE' or 'FALSE'. Click the filter dropdown on the 'KeywordMatch' column and uncheck 'FALSE' to keep only the rows that match your partial keywords.

Use Text.Contains for Explicit Partial Matching
Case-Insensitive Matching: Using Comparer.OrdinalIgnoreCase ensures that 'amazon' matches both 'Amazon Germany' and 'AMZN US' without requiring duplicate lowercase/uppercase entries in your keyword list.
Free Microsoft Office alternative

Handle Complex Data Filtering Easily with WPS Office

If you find Power Query's M-code syntax too complex or need a lightweight, free alternative for your daily data filtering tasks, WPS Office Spreadsheet is an excellent choice. It offers powerful built-in spreadsheet functions and advanced filtering tools while maintaining full compatibility with Microsoft Excel formats.

  1. 1. Download and Install: Download WPS Office for free from the official website and follow the installation wizard.
  2. 2. Open your dataset: Launch WPS Spreadsheet and open your existing Excel workbook containing your data and keywords.
  3. 3. Use built-in functions: Combine standard spreadsheet functions like SEARCH, ISNUMBER, and FILTER to achieve partial keyword matching without needing to open a separate query editor.
Fully compatible with Microsoft Excel (.xlsx, .xls) and CSV formatsPowerful formula engine supporting advanced array filteringFree and lightweight software that won't slow down your deviceFamiliar user interface that requires zero learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Can I make the Power Query keyword filter case-insensitive?

Yes, when using the Text.Contains function in Power Query, you can add a third parameter: Comparer.OrdinalIgnoreCase. This forces the query to ignore capitalization when comparing your data against your keyword list.

Why is my fuzzy join returning incorrect matches?

Fuzzy matching relies on a similarity threshold between 0.00 and 1.00. If the threshold is set too low (e.g., below 0.60), the algorithm becomes too lenient and will match words that only share a few letters. Increase the threshold in the Fuzzy matching options to improve accuracy.

Can I filter partial text using standard formulas instead of Power Query?

Yes. In modern spreadsheet applications, you can use a combination of the FILTER, ISNUMBER, and SEARCH functions to extract rows based on partial text matches directly on the spreadsheet canvas, without relying on Power Query.

How do I update the keyword list after setting up the query?

Because the keyword list is loaded from an Excel Table, you simply need to add or remove keywords directly in your Excel sheet, and then click 'Refresh All' on the Data tab. Power Query will automatically re-evaluate the text rows using the updated list.