Smart Systems for Home

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

Power Query: Replace Error with Null (Step-by-Step)

· 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 replace errors with null in Power Query, use the Replace Errors command on the column, or add a step that wraps the expression in try ... otherwise null. The Replace Errors route is the fastest for whole columns; the try ... otherwise route is what you need when you want to control exactly which errors become null and which still surface. Menu labels can differ slightly by Excel or Power BI version and region, so match on wording rather than exact position.

What You'll Need

  • Excel (Power Query is built into the Data tab) or Power BI Desktop, with the Power Query Editor open on a query that already shows errors.
  • A column that contains error values — they appear as the word Error in italic, often with a red or yellow marker.
  • Optional: a scratch copy of the query so you can compare before and after. Right-click the query in the Queries pane and choose Duplicate.

Step-by-Step

  1. Open the Power Query Editor. In Excel: select any cell in your table, then go to Data > From Table/Range. In Power BI Desktop: Home > Transform data. If the query is already loaded, right-click it in the Queries pane and choose Edit.
  2. Find the column with the errors. Use View > Column quality (and optionally Column distribution) to see the error percentage per column. This saves you scrolling through thousands of rows.
  3. Select the column header so the whole column is highlighted. If you only want to fix part of the column, filter or select rows first — Replace Errors applies to the current selection.
  4. On the Transform tab, choose Replace Errors. A small dialog opens asking for the replacement value.
  5. Type null in the value box and confirm. Power Query adds a step named something like Replaced Errors to the Applied Steps list, and the error cells turn blank.
  6. Check the result. Re-open View > Column quality; the error percentage for that column should now read 0%. Blank cells are expected — null is not the same as an error.
  7. If you need the rule to survive future refreshes and new error types, use the formula approach instead. Select the column, then Add Column > Custom Column and enter an expression such as try [Amount] otherwise null (replace Amount with your column name). This keeps the original column and gives you a clean one beside it.
  8. Rename the new column, remove the original if you no longer need it, and then Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to write the changes back.

Common Mistakes

  • Typing the word null in quotes. "null" is a text string, not a null value. In the Replace Errors dialog, type null without quotes; in a custom column formula, also leave it unquoted.
  • Replacing errors before the cause is fixed. If a column is text because of a bad type conversion, replacing errors with null hides the symptom but leaves the column the wrong type. Fix the type first where you can.
  • Assuming null equals zero or blank text. Null means no value. Downstream calculations may treat it differently from 0 or "". Decide deliberately which you need.
  • Replacing errors on the wrong step. Replace Errors applies at the point in the Applied Steps list where you run it. If an earlier step is still failing, move the step or fix the source.
  • Forgetting to refresh. The change is only in the query definition until you close and load or apply.

Tips

  • Use Column quality first — it tells you which columns are worth cleaning and how many rows are affected.
  • For a whole table rather than one column, select all columns before choosing Replace Errors, but check that a single replacement value makes sense for every type.
  • Prefer try ... otherwise when you want different fallbacks per column, or when you want to keep some errors visible as a warning that the source data changed.
  • Keep the original column until you have verified the cleaned one; deleting early makes comparison harder.
  • Document the step by renaming it in the Applied Steps list (right-click > Rename) so the next person knows why errors became null.

Troubleshooting

Errors come back after refresh. The source data changed, or a step before Replace Errors is producing new errors. Check the step order and re-run Column quality after refresh.

Replace Errors is greyed out. No column is selected, or the selection is not a single column. Click the column header first.

The column still shows errors. You may have replaced errors on a different step than the one currently selected, or the error is in a different column. Expand the error cell to read the message, which usually names the failing step.

Nulls break a downstream calculation. Replace null with 0 or an empty string instead, using the same Replace Errors dialog or a custom column. Choose based on what the calculation expects.

The query will not load at all. An error may exist in a step after your replacement, such as a type change or a merge. Work through the Applied Steps one at a time and watch where the preview first shows Error.

Frequently Asked Questions

Does Replace Errors change the data type of the column?

No. It only substitutes the error value. If the column type is wrong, change it separately with the data type icon in the column header.

What is the difference between null and blank in Power Query?

Null is the absence of a value. A blank cell in the preview usually represents null. An empty text string is a value and is not the same thing.

Can I replace errors with null in several columns at once?

Yes, if you select multiple columns before choosing Replace Errors. The same replacement value is applied to all selected columns, so make sure null is appropriate for each.

Will replacing errors with null remove the error message permanently?

It removes the error from the output at that step. The underlying cause still exists in the source, so new errors can appear on refresh.

Can I use try ... otherwise in the Replace Errors dialog?

No. The dialog accepts a value only. Use Add Column > Custom Column for a formula such as try [Column] otherwise null.

Does this work the same in Excel and Power BI?

The Power Query engine is shared, so the Replace Errors command and the try/otherwise pattern work in both. Menu locations differ slightly, and labels can vary by version and region.