How to Fix the #REF! Error in Excel

#REF! means a formula points to something that no longer exists: a deleted cell, row, column, sheet, or named reference. Excel cannot infer the missing target, so it shows the reference error.

Does this affect you?

Use this for Excel for Microsoft 365, Excel 2021, Excel 2019, and Google Sheets when a formula breaks after deleting or moving spreadsheet structure.

Undo immediately

This is the easiest fix if you catch the error right away.

  1. Press Ctrl+Z on Windows or Cmd+Z on Mac.
  2. Repeat until the deleted row, column, sheet, or range returns.
  3. Check that formulas display results again instead of #REF!.
  4. Save the repaired file.

Undo works only in the current editing session and before too much unrelated work makes undo unsafe.

Fix it manually when Undo is not available

Once the file is saved and closed, you need to rebuild the missing reference.

  1. Click a cell showing #REF!.
  2. Read the formula bar and note where #REF! appears.
  3. Use a backup, Microsoft 365 Version History, or a coworker copy to identify the original reference if possible.
  4. Replace #REF! with the correct current cell, range, sheet, or name.
  5. Use Ctrl+H and search within Formulas for #REF! to locate other broken formulas.

Excel does not keep a reliable memory of what the deleted reference used to be, so a backup or domain knowledge is often required.

More control

Use sturdier formulas

Hardcoded offsets and formulas that depend heavily on row counts can break during restructuring. INDEX/MATCH, XLOOKUP, Tables, and named ranges are often more resilient.

Trace dependents before deleting

Before removing cells, use Formulas > Trace Dependents to see which formulas rely on them. It reveals the impact before the deletion.

Fix broken charts separately

Charts can break when source data is deleted. Right-click the chart, choose Select Data, and point the chart data range at valid cells.

Save a static backup before restructuring

Before major row, column, or sheet changes, copy important formula results and Paste Special > Values into a backup sheet or file.

Sources

  • Microsoft Support – Correct a #REF! error (2025)
  • Microsoft Support – Detect errors in formulas (2025)
  • Microsoft Support – INDEX function (2025)
Disclosure: This post may contain affiliate links which means I may receive a commission for purchases made through links. I will only recommend products that I have personally used! Learn more on my Private Policy page.
A thoughtful woman reads a newspaper while enjoying coffee at an indoor workspace.

DEALWEEK

SUBSCRIBE AND GET 20% OFF YOUR NEXT ORDER! OFFER ENDS SOON - DON’T MISS OUT!

We don’t spam! Read our privacy policy for more info.

Shopping Cart