New Tool Radar

AI for Data & Spreadsheets

How to Handle Error Values in Power Query With Replace Errors

Replace error values in a Power Query column with a default, and keep the affected rows visible for review.

Schematic with three steps: Find the errors first; Replace the errors with a stated default; Count the replaced rows in the loaded.

When a type change fails on some rows, those cells show Error in Power Query. Replace Errors sets a default value for them, but a replaced error is also a hidden problem, so keep the affected rows visible and counted.

What you need

  • Excel with the data loaded in the Power Query Editor
  • A note of what the error cells should become, such as null
  • A copy of the source file

Step 1: Find the errors first

Filter the column to Error, or use Keep Rows, Keep Errors, to see exactly which rows failed and why. A type error usually means text in a number column or a date in the wrong format.

Step 2: Replace the errors with a stated default

Use Transform, Replace Errors to set a default value, such as null for a missing amount. Write the default down; a default of zero would change totals, while null keeps the row visibly incomplete.

Step 3: Count the replaced rows in the loaded table

After Close and Load, count how many rows carry the default value. If the count is larger than expected, the type change itself may be wrong rather than the data.

Worked example: synthetic amount column with three errors

The table below is a synthetic example. It shows the expected result of replacing errors; no file was imported.

Check Count Result
Rows loaded 60 Source
Cells showing Error 3 Text in a number column
Errors replaced with null 3 Rows kept
Rows lost 0 Pass

Expected result (UNTESTED). 3 of 60 rows show Error after the type change; all 3 are replaced with null and kept in the table, so no rows are lost and the problem rows stay visible. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Replacing an error with zero changes totals; use null when the value is genuinely unknown.
  • Filtering out Error rows deletes the evidence; send them to a separate query for review instead.
  • Find out why the error happened before replacing it; a wrong type choice causes more errors.

Sources

See all