Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Error Correction in Excel: 5 Fixes

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To correct errors in Power Query, first identify the error type: locate the error cell in the preview, click it to read the message, then choose a fix such as replacing the error with a value, removing the row, or correcting the source data. The five most common fixes are: remove rows with errors, replace errors with a default value, correct data type mismatches, fix broken source paths or credentials, and repair column name or schema changes.

What You'll Need

  • Excel with Power Query (Excel 2016 and later, or Microsoft 365).
  • Access to the original data source (file, folder, database, or web page).
  • Permission to edit the source data if the error originates there.
  • Basic familiarity with the Power Query Editor: Home, Transform, Add Column, and View tabs.

Step-by-Step

  1. Open the Query Editor. In Excel, select any cell in your query output, then go to Data > Queries & Connections, right-click the query, and choose Edit. Alternatively, use Data > Get Data > Launch Power Query Editor. Menu labels can differ slightly by Excel version and region.
  2. Locate the error cells. In the Power Query Editor preview, error values appear as the word Error with a red or yellow background. Click the word Error to see a message such as “We couldn't convert to Number” or “The key didn't match any rows in the table.” Note which column and row it affects.
  3. Decide on the correction strategy. If the error is caused by bad source data, fix the source and refresh. If the source cannot be changed, use one of the following built-in corrections.
  4. Remove rows with errors. Select the column containing errors, then go to Home > Remove Rows > Remove Error Rows. This deletes the entire row from the query. Use it only when the row is not needed.
  5. Replace errors with a value. Select the column, then go to Transform > Replace Values > Replace Errors. Enter the replacement value, such as 0, blank, or “Unknown.” This keeps the row and fills the error.
  6. Correct data type mismatches. Click the data type icon in the column header (for example, ABC/123) and choose the correct type. If text values contain numbers with commas or currency symbols, first use Transform > Format > Trim and Clean, then change the type. For locale-specific decimals, use Transform > Data Type > Using Locale and pick the correct locale.
  7. Fix broken source paths or credentials. Go to Home > Data Source Settings. Check the file path, URL, or server name. If credentials have expired, select Edit Permissions and sign in again. For file-based sources, confirm the file still exists and is not open in another program with a lock.
  8. Repair column name or schema changes. If the source added, removed, or renamed columns, the query may show errors in steps that reference old names. Open the Applied Steps pane, click the step before the error, and use the gear icon to update the column reference. Then delete or re-add the affected step.
  9. Check for nulls and blanks. Some errors come from empty cells being converted to numbers or dates. Use Transform > Replace Values to replace null with a default, or Home > Remove Rows > Remove Empty.
  10. Apply and close. When the preview shows no errors, select Home > Close & Load to send the cleaned data to a worksheet or the Data Model. Then use Data > Refresh All to confirm the query runs without errors.

Common Mistakes

  • Removing error rows without checking whether the row contains other useful data.
  • Replacing errors with zero when the correct value is unknown, which can distort totals.
  • Changing the data type before cleaning text (extra spaces, non-breaking spaces, or line breaks often cause conversion errors).
  • Editing the output table in Excel instead of the query; manual edits are lost on refresh.
  • Ignoring the step where the error first appears; fixing a later step will not resolve the root cause.

Tips

  • Use View > Column Quality and Column Distribution to spot errors, empty values, and outliers before they break a step.
  • Add a step that filters out errors early, so later transformations run on clean data.
  • Keep a copy of the original query (right-click > Duplicate) before making destructive changes such as removing rows.
  • When working with CSV files, set the correct delimiter and encoding in the source step; wrong encoding often produces “DataFormat.Error.”
  • For web sources, confirm the table index or selector still matches the page structure.

Troubleshooting

  • Error persists after refresh: The source data may have changed again. Re-open the query editor and check the first step that shows an error.
  • “We couldn't convert to Number”: The column contains text such as “N/A” or spaces. Use Replace Values to remove non-numeric characters, or change the type to Text first, clean, then convert.
  • “The key didn't match any rows”: A merge or append step references a column or table that no longer exists. Update the step's column selection.
  • Credentials error: Go to Data > Get Data > Data Source Settings, select the source, and choose Edit Permissions to re-enter credentials.
  • Query loads but Excel shows errors: The error may be in a calculated column or a step after the preview was last refreshed. Use Home > Refresh Preview to update the preview before closing.
  • If that did not work: Delete the query and recreate it from the source, or use Data > Get Data > Data Source Settings to clear permissions and reconnect. As a last resort, start a new blank query and paste the M code from the Advanced Editor, correcting the failing step.

Frequently Asked Questions

Why does Power Query show errors only after refresh?

The preview may be stale. Refresh the preview in the editor, and check whether the source data changed since the last load.

Can I replace all errors in a table at once?

You can replace errors column by column. Select each column and use Transform > Replace Values > Replace Errors. There is no single button for all columns.

What is the difference between Remove Error Rows and Replace Errors?

Remove Error Rows deletes the entire row. Replace Errors keeps the row and substitutes a value you choose.

How do I fix a data type error caused by a different locale?

Use Transform > Data Type > Using Locale and select the locale that matches the source format, such as English (United Kingdom) for dates written day/month/year.

Does correcting errors in Power Query change the original file?

No. Power Query transformations apply to the query output only. The source file remains unchanged unless you edit it directly.

Why do I get an error after renaming a column in the source?

Steps that reference the old column name break. Open the Applied Steps, find the step with the error, and update the column reference to the new name.