Fix the #REF! Error in Excel: Causes and Step-by-Step Fixes

How to fix the #REF! error in Excel - cover graphic
Image: Spreadsheet Tutorials & Productivity (original graphic)

The #REF! error means a formula points to a cell or range that no longer exists or can't be reached. It usually appears right after you delete a row, column or sheet, but it can also come from a lookup that asks for a column outside its range, an INDEX position that is too large, or an INDIRECT reference to a sheet that isn't there. This guide shows you how to find the broken reference and fix it so it doesn't come back.

Quick answer: If you just deleted something, press Ctrl+Z to undo it. Otherwise, click the error cell and look for #REF! inside the formula bar, then replace that part with a valid reference. To stop it from happening again, use ranges such as =SUM(B2:D2) instead of chains like =B2+C2+D2.

The sample data

We'll use a small quarterly sales table. Column E adds the quarters with plus signs, and column F adds them with SUM:

ProductQ1Q2Q3Total (+)Total (SUM)
Notebook1,2401,3101,4804,0304,030
Desk Lamp8607959102,5652,565
Monitor3,1502,9803,3209,4509,450
Keyboard6407106852,0352,035
Mouse4204554981,3731,373
Webcam9158801,0202,8152,815
Headset1,1051,1901,2603,5553,555
USB Hub310295340945945

The formulas in row 2 are =B2+C2+D2 (column E) and =SUM(B2:D2) (column F). Both return 4,030. Now watch what happens when column C (Q2) is deleted.

Excel sheet after deleting column C: the plus formula shows #REF! while SUM returns 2,720
After deleting Q2, the plus-sign total breaks while the SUM total adjusts. Image: Spreadsheet Tutorials & Productivity (original screenshot)

Cause 1: You deleted a cell, row or column the formula used

This is the most common cause. When a cell named directly in a formula is deleted, Excel has nothing left to point to, so it writes #REF! into the formula itself:

Before:  =B2+C2+D2
After:   =B2+#REF!+C2

The whole result becomes #REF!, even though the other two cells still exist. The SUM version behaves differently: the range simply shrinks.

Before:  =SUM(B2:D2)   -> 4,030
After:   =SUM(B2:C2)   -> 2,720  (1,240 + 1,480)

In our test, every row in the plus-sign column turned into #REF!. The SUM column kept working, and the grand total =SUM(F2:F9) changed from 26,768 to 18,153 because Q2 was no longer included.

How to fix it

  1. Undo right away. If you just made the deletion, Ctrl+Z restores the column and the formulas.
  2. Rewrite the reference. Click the cell, find #REF! in the formula bar, and replace it with the correct cell or remove it. In our example the fixed formula is =B2+C2, or better, =SUM(B2:C2).
  3. Prefer ranges. Functions that take a range (SUM, AVERAGE, COUNT) adjust when a row or column inside the range is deleted. Formulas that list single cells one by one don't.

A #REF! that has been saved in a formula will not fix itself. Restoring the deleted column later does not bring the old reference back, so you have to edit the formula.

Cause 2: A lookup asks for a column outside its range

In VLOOKUP, the third argument is the column number inside the lookup table. If that number is larger than the number of columns in the table, Excel returns #REF!:

=VLOOKUP("Mouse", A2:D9, 5, FALSE)   -> #REF!  (A2:D9 has only 4 columns)
=VLOOKUP("Mouse", A2:D9, 4, FALSE)   -> 498

This also happens indirectly. After we deleted column C, the table range became A2:C9, but a hard-coded column number of 4 stayed in the formula, so the lookup broke. Changing it to 3 returns 498 again, which is the Mouse value for Q3.

To avoid this, use a lookup that points at a return column instead of counting columns. INDEX with MATCH works in every Excel version:

=INDEX(C2:C9, MATCH("Mouse", A2:A9, 0))

In Excel 365 and Excel 2021 or later, XLOOKUP does the same job:

=XLOOKUP("Mouse", A2:A9, C2:C9)

Because these formulas reference the return column directly, inserting or deleting other columns doesn't change which column they read.

Cause 3: INDEX points past the end of its range

INDEX returns #REF! when the row or column number is bigger than the range. D2:D9 contains 8 cells, so:

=INDEX(D2:D9, 5)    -> 498
=INDEX(D2:D9, 12)   -> #REF!

If the position comes from another calculation, check that calculation first. A MATCH on a different-sized range is a common culprit, so make sure both ranges start and end on the same rows.

Cause 4: INDIRECT refers to a sheet or workbook that isn't available

INDIRECT builds a reference from text. If the text names a sheet that doesn't exist, the result is #REF!:

=INDIRECT("Budget!B2")   -> #REF!  (no sheet named Budget)

Check the sheet name for typos and extra spaces. Sheet names that contain spaces need single quotes, for example =INDIRECT("'Sales 2026'!B2"). In Excel, INDIRECT that points to another workbook also returns #REF! when that workbook is closed.

Cause 5: A copied formula moves off the edge of the sheet

Relative references shift when you copy a formula. If cell B2 contains =A1 and you paste it into B1, the reference would have to move above row 1, which doesn't exist, so Excel shows #REF!. Use absolute references such as $A$1 when the formula must always point to the same cell.

How to find every #REF! in a workbook

  • Find: press Ctrl+F, type #REF!, open Options, set Look in to Formulas and choose Find All. This lists every formula that contains a broken reference.
  • Go To Special: press F5, choose Special, then Formulas with only Errors ticked. This selects every formula that returns an error, not only #REF!.

Common mistakes

  • Hiding the error with IFERROR. =IFERROR(VLOOKUP("Mouse",A2:D9,5,FALSE),"Check column") shows "Check column" instead of #REF!, but the formula is still wrong. Fix the reference first and use IFERROR only for expected cases.
  • Deleting a "helper" column that other sheets use. Before you delete, select the column and use Formulas > Trace Dependents to see what relies on it.
  • Using Find & Replace to blank out #REF!. Removing the text can leave a formula that calculates without error but gives the wrong total. Check each one.

FAQ

Why does #REF! stay after I re-insert the deleted column?

Once Excel writes #REF! into a formula, the link to the old cell is gone. A new column in the same place isn't treated as the old one. Use undo if you can, or edit the formula by hand.

Does Google Sheets show #REF! too?

Yes. Deleting a referenced cell in Google Sheets also produces #REF!. Sheets uses the same error for a few other problems, such as a circular dependency or an array result that can't expand because cells are in the way. Hover over the cell to read the exact message.

Is #REF! the same as #N/A?

No. #N/A means a lookup ran but didn't find the value. #REF! means the formula's reference itself is invalid.

Summary

#REF! always points to a broken reference. It might be a deleted cell, a column number outside a lookup range, an INDEX position past the end, or an INDIRECT target that doesn't exist. Undo if you can, otherwise replace the #REF! part of the formula. To prevent it, use ranges and lookups that point at a return column directly. For more fixes like this, browse the Errors & Fixes tutorials or the full Excel collection.

Comments