Start free

#REF! error in Excel: what it means and how to fix it

Works in every version of Excel

Key takeaways

  • #REF! means a formula refers to a cell that isn't valid: usually one that was deleted.
  • Deleted it by accident? Press Ctrl+Z straight away and the formula comes back whole.
  • Formulas built on ranges, such as =SUM(B2:D2), survive a deleted column; =B2+C2+D2 doesn't.
  • A column number past the end of a VLOOKUP table, or a row past the end of an INDEX range, also gives #REF!.
Jump straight to the practice sheet
On this page

#REF! means a formula points at a cell that isn’t valid. Most often the cell existed when the formula was written and was then deleted, with its whole row, column or sheet. Excel can’t guess what should take its place, so it writes #REF! into the formula where the reference was. The other common cause is asking a function for a column or row past the edge of its range.

1. A deleted row or column

The total in E2 was =B2+C2+D2: Q1, Q2 and Q3. Then column C, Q2, was deleted. Q3 moved left into column C, the total moved into D2, and the reference to the deleted column became #REF!:

D2=B2+#REF!+C2
RowABCD
1RepQ1Q3Total
2Ana120150#REF!

If you just deleted it, press Ctrl+Z and everything comes back. Otherwise, edit the formula and replace #REF! with the right reference, or rewrite it as a range:

=SUM(B2:C2) → 270

A range is the lasting fix. Had the total been =SUM(B2:D2) from the start, deleting column C would have shrunk it to =SUM(B2:C2) and it would have kept working.

2. A column number past the end of the table

VLOOKUP’s third argument counts columns inside its table, starting from 1. A2:B5 has two columns, so asking for column 3 points past its edge:

F2=VLOOKUP(E2,A2:B5,3,FALSE)
RowABCDEF
1CodeItemStockFindStock
2P-14Bolts320P-22#REF!
3P-09Nuts1,150
4P-22Washers80
5P-03Screws640

Widen the table so it reaches the column you want:

=VLOOKUP(E2,A2:C5,3,FALSE) → 80

The same happens when a column number was right until a column was deleted from the table. XLOOKUP avoids it: it takes the return column as a range, so there’s no number to go stale.

3. A row or column past the end of an INDEX range

INDEX returns the item at a given position. Ask for a position the range doesn’t have and it returns #REF!. C2:C5 holds four stock levels, so there is no 5th:

F2=INDEX(C2:C5,5)
RowABCDEF
1CodeItemStockFindStock
2P-14Bolts320P-22#REF!
3P-09Nuts1,150
4P-22Washers80
5P-03Screws640

Let MATCH work out the position from the code instead of typing it:

=INDEX(C2:C5,MATCH(E2,A2:A5,0)) → 80

4. A formula copied off the edge of the sheet

Relative references move when you copy a formula. =A1 in B2 means “the cell one up and one left”. Copy it to B1 and it would point one row above row 1, which doesn’t exist, so the copy becomes =#REF!. Copy formulas only where the cells they point at exist, or lock the reference with $ (=$A$1).

5. A deleted sheet or a closed workbook

A formula that reads another sheet, such as =Sales!B4, becomes =#REF!B4 when that sheet is deleted, and a deleted sheet can’t be brought back with Undo. INDIRECT, which builds a reference from text, returns #REF! when it points at a workbook that is closed: open that workbook and the formula recalculates.

Practise it: fix a VLOOKUP that shows #REF!

Your task: In F2, return the stock of the code in E2. The formula =VLOOKUP(E2,A2:B5,3,FALSE) shows #REF!: write one that works.

Graded live
RowABCDEF
1CodeItemStockFindStock
2P-14Bolts320P-09
3P-09Nuts1,150
4P-22Washers80
5P-03Screws640

Write the formula in the bar above, then press Check or Enter.

Hint

Keep column 3, but make the table reach the Stock column: A2:C5. End with FALSE for an exact match.

Solution

=VLOOKUP(E2,A2:C5,3,FALSE) Any formula that returns the same result passes.

Find them all at once

Press Ctrl+F, search for #REF! with Look in set to Formulas, and choose Find All. The list shows every broken formula in the sheet; click one to go to it. Don’t hide #REF! with IFERROR: it always means the formula lost track of its data.

Practise this in a lessonLook up a product priceA full exercise in the app's live grid, graded on what your formula calculates.Open the lesson

FAQ

What does #REF! mean in Excel?

The formula refers to a cell that isn't valid. Most often the row, column or sheet it pointed at was deleted, and Excel replaced the reference with #REF!.

How do I find every #REF! in a workbook?

Press Ctrl+F, type #REF!, open Options, set Within to Workbook and Look in to Formulas, then choose Find All. Each result is a formula with a broken reference.

Can I get the deleted reference back?

Undo (Ctrl+Z) restores it if you act straight away. After that, edit the formula, select #REF! in the formula bar and type or click the right cell or range in its place.

Why does VLOOKUP return #REF!?

Its column number is larger than the number of columns in the table range. Widen the range, or lower the column number.

Summarize this guide withChatGPTPerplexityClaude

Keep going

Guides that build on this one.

All guides
Errors & fixesPractice sheet

#N/A error in Excel: what it means and how to fix it

#N/A means a lookup didn't find what it was looking for. Here are the six usual causes, how to spot each one on the sheet, and the fix, with a practice sheet.

2 min read · Updated
Errors & fixesPractice sheet

#NAME? error in Excel: what it means and how to fix it

#NAME? means Excel doesn't recognise a word in your formula: a misspelt function, text without quotes, a missing colon. Find it and fix it, with a practice sheet.

2 min read · Updated
Errors & fixesPractice sheet

#DIV/0! error in Excel: what it means and how to fix it

#DIV/0! means a formula divided by zero or by an empty cell. Why it happens, averages of nothing included, and how to show a clean result, with a practice sheet.

2 min read · Updated

Reading is step one. Writing the formula is the skill.

Practise in a live grid that grades what your formula calculates, with a specific hint when it's wrong.

Runs in your browser · Graded on your result · No install