Power Query List.RemoveItems Function: How to Use It
In this article
The List.RemoveItems function in Power Query removes specified values from a list, leaving only the items that don’t match. It’s useful for cleaning data by excluding known bad, redundant, or irrelevant entries without rewriting your entire query. No setup is required beyond having a list in Power Query — it works natively in the Power Query Editor in Excel, Power BI, or other supported platforms.
What You'll Need
- A data table or query loaded into Power Query Editor (Excel 2016+, Power BI Desktop, or similar)
- A list column containing text, numbers, dates, or other values you want to filter
- The exact values you wish to remove (case-sensitive for text)
- Access to the Power Query Editor (Data > Get Data > Transform Data in Excel, or Transform Data in Power BI)
Step-by-Step
- Open Power Query Editor by selecting your table in Excel or Power BI, then clicking Transform Data on the Data tab.
- Identify the column containing the list you want to modify. If your data is in a single column, proceed. If values are spread across multiple columns, use Combine Columns first to create a single list column.
- Click on the column header to select it. In the formula bar, you’ll see something like
Column1. Replace that entire formula with a new one using List.RemoveItems. - Type:
List.RemoveItems(Column1, {"value1", "value2", "value3"}). Replace "value1", "value2", etc., with the actual values you want to remove. Use quotes for text, no quotes for numbers or dates. - For example, if your column contains product names and you want to remove "Defective", "Out of Stock", and "Discontinued", type:
List.RemoveItems(Column1, {"Defective", "Out of Stock", "Discontinued"}). - Press Enter. Power Query will immediately update the column, removing all exact matches of those values.
- Check the results visually. Scroll through the column to confirm the targeted items are gone and no unintended values were removed.
- If the column was originally a list of records or nested tables, convert it to a simple list first using Expand or Extract Values — List.RemoveItems only works on flat lists of scalars (text, number, date, etc.).
- Once satisfied, click Close & Apply to load the cleaned data back into your worksheet or report.
Common Mistakes
- Using incorrect data types: If your list contains numbers but you write "5" (text), it won’t match 5 (number). Always match type exactly — use 5, not "5".
- Forgetting curly braces: List.RemoveItems requires the second argument to be a list literal enclosed in curly braces { }. Using parentheses () or square brackets [] will cause an error.
- Case sensitivity: "Apple" and "apple" are treated as different values. If your data has mixed casing, convert to uniform case first using Text.Lower or Text.Upper.
- Removing blank values unintentionally: If your list includes nulls or empty strings and you don’t include them in the removal list, they remain. To remove blanks, explicitly add {"", null} to your removal list.
- Applying it to non-list columns: If your column contains records, tables, or lists of lists, List.RemoveItems will fail. Use Transform > Convert to List first if necessary.
Tips
- Use a separate reference table: If you’re removing many values, create a small table in Excel with the values to remove, load it into Power Query as a separate query, then reference it:
List.RemoveItems(Column1, RemoveList[Column1]), where RemoveList is your reference table’s name. - Combine with List.Select for complex logic: Use List.RemoveItems to remove known bad items, then List.Select to filter remaining items based on conditions like length or pattern.
- Test with a small sample: Before applying to a large dataset, duplicate your query and test List.RemoveItems on a filtered subset to verify behavior.
- Use the Advanced Editor: If the formula bar feels limiting, click View > Advanced Editor to manually edit the M code. This gives you more control and visibility into the full syntax.
- Document your removal list: Add a comment in the Advanced Editor like // Removed: Defective, Out of Stock, Discontinued — this helps future reviewers understand intent.
Troubleshooting
- Error: "We couldn't convert the value to a list" — The column you’re targeting isn’t a list. Check its data type in the column header (it should say "List" or show a list icon). If it says "Text" or "Number", use Split Column > By Delimiter or Extract > Values to convert it into a list first.
- Error: "The name 'Column1' wasn't recognized" — The column name in your formula doesn’t match the actual column name. Click the column header and verify the exact name. Change it in the formula to match.
- Values aren’t being removed — Check for hidden spaces or non-breaking characters. Use Text.Trim around your values:
List.RemoveItems(Column1, {Text.Trim("value ")}). Also confirm case matching. - Power Query crashes or freezes — This usually happens with very large lists (100k+ items). Break the removal into smaller steps, or filter out non-relevant rows before applying List.RemoveItems.
- Nulls remain after removal — If you didn’t include null in your removal list, they stay. Add null explicitly: {"value1", null}.
Frequently Asked Questions
Can List.RemoveItems remove duplicates?
No. List.RemoveItems only removes exact matches you specify. To remove duplicates, use Remove Duplicates from the Home tab or use List.Distinct.Does it work with dates?
Yes. Use date literals like {#date(2023, 5, 15)} to remove specific dates. Ensure the column’s data type is Date, not Text.Can I remove items based on partial matches, like "Error*"?
No. List.RemoveItems only matches exact values. For partial matching, use List.Select with Text.Contains:List.Select(Column1, each not Text.Contains(_, "Error")).