Excel Power Query Expression Error: Fix It Fast
In this article
A Power Query expression error in Excel usually means the M formula can't be parsed or evaluated — often because of a typo, a wrong data type, a missing step reference, or a function that doesn't exist in your version. The fastest fix is to open the Query Editor, read the exact error message, and check the step that produced it against the M code in the formula bar. This guide walks through locating the error, correcting the common causes, and preventing it from coming back.
What You'll Need
- Excel with Power Query (Excel 2016 or later, or Microsoft 365; Power Query is built in as Get & Transform Data).
- The query that is failing, or a new blank query to test expressions.
- Access to the Query Editor (Data > Get Data, or right-click a query and choose Edit).
- Basic familiarity with the Applied Steps pane and the formula bar.
Step-by-Step
- Open the Query Editor. In Excel, go to the Data tab and click Get Data > Launch Power Query Editor (labels can differ slightly by version and region). Alternatively, right-click any query in the Queries & Connections pane and choose Edit.
- Find the failing step. In the Applied Steps pane on the right, a step with an error shows a red icon or a warning. Click that step. The preview pane will show the error message and often a small link such as "Show error" or a detailed message in the formula bar area.
- Read the full error text. Common messages include "Expression.Error: The name 'X' wasn't recognized", "We couldn't find an expression", "Token Comma expected", or "The field 'X' of the record wasn't found". The wording tells you whether the problem is a name, a syntax token, a missing column, or a type mismatch.
- Check the formula bar for that step. Click the step and look at the formula bar. Compare the M code with what you intended. A missing comma, an unclosed parenthesis, or a misspelled function name will cause a parse error before the query even runs.
- Verify names and references. If the error says a name wasn't recognized, check that every step name and column name referenced in the formula matches exactly — Power Query is case-sensitive and treats spaces in column names as significant. Use the exact column name as shown in the preview header.
- Check data types. If the error mentions a type mismatch, click the step that changes type (often "Changed Type") and confirm the source column actually contains values that can convert. For example, converting a column with text like "N/A" to a number will fail; filter or replace those values first.
- Test the expression in a blank query. To isolate the problem, create a new blank query (Home > New Source > Blank Query) and paste the suspect expression into the formula bar. This shows whether the error is in the expression itself or in the data it receives.
- Fix and refresh. Correct the formula or step, then click Close & Load (or Close & Load To) to apply changes. If the error persists, repeat from step 2 — the error may have moved to a later step.
Common Mistakes
- Misspelling a step name. Step names are case-sensitive and must match exactly, including spaces and punctuation.
- Using a column name that no longer exists. Renaming or removing a column earlier in the query breaks any later step that references the old name.
- Forgetting commas between arguments. M functions require commas between parameters; a missing comma produces a "Token Comma expected" error.
- Assuming functions are available in all versions. Some newer M functions may not exist in older Excel builds; check the function name against your version's documentation.
- Editing the wrong step. Changes made in the formula bar apply to the selected step only; editing a later step won't fix an error in an earlier one.
Tips
- Use the Advanced Editor (Home > Advanced Editor) to see the full M code and spot syntax problems more easily than in the formula bar.
- Name your steps clearly (double-click a step to rename) so error messages point to something meaningful.
- Add a simple step after a complex one to confirm the data looks right before continuing.
- When copying M code from the web, watch for smart quotes or non-breaking spaces that break syntax.
- Keep a backup of the working query before making large changes; you can duplicate a query (right-click > Duplicate) to experiment safely.
Troubleshooting
If the error persists after checking the formula, try these steps in order:
- Close the Query Editor without saving, reopen the query, and refresh — sometimes a stale preview causes a false error.
- Check the source data: if a column was renamed or removed at the source, update the step that references it.
- Use the "Show Error" link in the preview to see the exact row and value causing the problem.
- If the error is in a custom function, test it separately with a small table to confirm it works.
- If all else fails, rebuild the query step by step from the source, adding one transformation at a time and refreshing after each, to isolate the failing step.
Frequently Asked Questions
What does "Expression.Error: The name 'X' wasn't recognized" mean?
It means Power Query cannot find a step, column, or function named X. Check spelling, case, and whether the name exists at that point in the query.
Why does my query work in one workbook but not another?
The source data or column names may differ, or the second workbook may use a different Excel version with different M function support. Compare the queries in the Advanced Editor.
Can I ignore an expression error and still load the query?
No — Power Query will not load a query that contains an error. You must fix or remove the failing step first.
How do I find which step caused the error?
Click each step in the Applied Steps pane; the preview updates and the error appears on the step that fails. The red icon marks it.
Does Power Query support all Excel functions?
No. Power Query uses its own M language, which is different from Excel worksheet functions. Some functions have similar names but different syntax.
What should I do if the error message is vague?
Use the Advanced Editor to inspect the full M code, and test parts of the expression in a blank query to narrow down the cause.