A #REF! error is Excel’s way of saying a formula points to a cell that no longer exists. It usually appears right after someone deletes a column, pastes over a range or removes a worksheet, and it can spread through a whole report in seconds. This guide shows how to fix REF error results in Excel by finding the broken reference, repairing it and rewriting the formula so the same thing does not happen again. The same ideas apply in Google Sheets and LibreOffice Calc.
All examples use one small sales table, and a free practice workbook with the same data is attached to this post.
What the #REF! error means
REF is short for reference. When a formula refers to a cell, range, sheet or workbook that Excel can no longer resolve, the reference is replaced with #REF! inside the formula itself. That is the key difference from errors such as #N/A or #VALUE!: the formula has been physically damaged, so the original address is gone.
Because of that, the best fix is often the quickest one. If you have just deleted something, press Ctrl+Z (Windows) or Cmd+Z (Mac) straight away and the references come back.
The sample data
The table sits in A5:E10 with monthly sales for five reps.
| Rep | Region | Jan | Feb | Mar |
|---|---|---|---|---|
| Aarav Mehta | North | 4200 | 3900 | 4650 |
| Priya Nair | South | 3800 | 4100 | 4300 |
| Daniel Ross | West | 5100 | 4700 | 4950 |
| Meera Iyer | East | 2900 | 3350 | 3600 |
| Sam Carter | North | 4450 | 4600 | 4800 |
How to fix REF error causes one by one
1. A deleted column or row in an explicit reference
Suppose F6 holds the quarter total written as separate cells:
=C6+D6+E6
Delete column D (Feb) and the formula turns into =C6+#REF!+D6, which returns #REF!. Excel cannot shift a single-cell reference that was deleted, so it breaks. Rewrite the total with a range instead:
=SUM(C6:E6)
For Aarav Mehta this returns 12750. If you now delete any column inside the range, Excel simply shrinks it to C6:D6 and the formula keeps working. The same logic applies to rows: =SUM(C6:C10) survives a deleted row, while =C6+C7+C8+C9+C10 does not.
2. Cells pasted or moved over a referenced range
Cutting a block of cells and pasting it on top of cells that other formulas use also produces #REF!, because the original cells are overwritten. Undo the paste, then use Paste Special > Values if you only meant to copy results. When you need to move data, drag the whole range or insert cut cells instead of pasting over the top.
3. VLOOKUP asks for a column that is not in the range
This formula looks up Meera Iyer in H6 and asks for column 6 of a five-column range:
=VLOOKUP(H6,$A$6:$E$10,6,FALSE)
The range only has five columns, so the result is #REF!. Use a column number inside the range (5 returns 3600 for March) or, better, switch to XLOOKUP, which points at the return column directly and is not affected by inserted or deleted columns:
=XLOOKUP(H6,$A$6:$A$10,$E$6:$E$10)
4. INDEX or OFFSET goes outside its range
=INDEX(C6:E10,6,1) asks for row 6 of a five-row range and returns #REF!. Hard-coded positions break as soon as the table changes size, so let MATCH find the row:
=INDEX($C$6:$E$10,MATCH(H6,$A$6:$A$10,0),2)
That returns 3350, Meera’s February sales. OFFSET fails in the same way when its offset lands above row 1 or left of column A, for example =OFFSET(A6,-6,0).
5. A deleted sheet or an INDIRECT text that points nowhere
Deleting a worksheet turns every reference to it into #REF!, and Microsoft notes that a deleted sheet cannot be recovered, so undo immediately or restore an earlier version of the file. INDIRECT has a related problem: it builds a reference from text, so a misspelled or renamed sheet name returns #REF!. Wrap it so the message is useful:
=IFERROR(INDIRECT("'"&H9&"'!B2"),"Sheet not found")
INDIRECT and dynamic array formulas that point at another workbook also return #REF! while that workbook is closed. Open the source file, or replace the link with a direct reference that Excel can store.
6. A relative formula copied past the edge of the sheet
If B2 contains =A1 and you copy it up to B1, Excel would need the cell above A1. That does not exist, so the copy shows =#REF!. Check relative references before filling formulas upwards or to the left, and add $ signs where a reference should stay fixed.
Quick reference: causes and fixes
| Cause | Broken example | Fix | |
|---|---|---|---|
| Deleted column or row | =C6+#REF!+D6 | =SUM(C6:E6), or Ctrl+Z | |
| Paste over referenced cells | Formula shows #REF! after a paste | Undo, then Paste Special > | Values |
| VLOOKUP column out of range | =VLOOKUP(H6,A6:E10,6,FALSE) | Use 5, or XLOOKUP | |
| INDEX row or column out of range | =INDEX(C6:E10,6,1) | INDEX with MATCH | |
| Missing sheet or closed workbook | =INDIRECT(“‘Old Targets’!B2”) | Correct the name, open the file, IFERROR | |
| Relative copy past row 1 or column A | =#REF! | Fix the source cell or use $ references |
Find every #REF! in a workbook
- Go To Special: press F5 (or Ctrl+G), choose Special, then Formulas and tick only Errors. Excel selects every error cell on the sheet.
- Find: press Ctrl+F (Cmd+F on Mac), search for #REF!, set Look in to Formulas and choose Find All to list each broken formula across the sheet or workbook.
- Trace Error: select the cell, then use Formulas > Error Checking > Trace Error to see which precedents are involved.
- Count them: =COUNTIF(K6:K10,”#REF!”) counts only the #REF! results in a range, so you can confirm the number drops to zero after each repair.
Avoid blanket Find and Replace of #REF! with nothing. It removes the error text but can leave formulas that quietly calculate the wrong thing. Repair each reference instead. Microsoft’s guide on how to correct a #REF! error lists the less common cases too, such as OLE and DDE links.
Should you hide #REF! with IFERROR?
Only after the cause is fixed. IFERROR hides every error type, so a damaged reference can sit unnoticed for months. Use it for expected situations, like the INDIRECT example above, not as a cover for deleted data. Our guide to fixing the #VALUE! error explains the same rule for other errors.
#REF! in Google Sheets and LibreOffice Calc
Google Sheets uses #REF! for more situations than Excel. Hover over the cell to read the message:
- Reference does not exist: a deleted row, column or sheet, exactly as in Excel.
- Circular dependency detected: the formula refers to its own cell, directly or through other cells.
- Array result was not expanded: a spilling formula is blocked by existing data, the Sheets version of Excel’s #SPILL! (see how to fix the #SPILL! error).
LibreOffice Calc shows #REF! for its error code 524, “Not a valid reference”, when a referenced column, row or sheet is missing. The LibreOffice Calc error codes page lists it with the other codes. The SUM range, XLOOKUP and INDEX with MATCH fixes above work in both apps.
Practice workbook
The companion workbook has the sales table, a lookup area and a column of mixed errors. Repair the total, the lookups and the INDIRECT formula in the yellow cells, count the #REF! results, then compare your answers with the Solutions sheet.
FAQ
Can I recover a reference after the file is saved?
Not from the formula itself, because the original address has been replaced. Use Undo before closing, or open an earlier copy through version history and copy the correct formula back.
Why does a deleted column break =C6+D6+E6 but not =SUM(C6:E6)?
A range has a start and an end that Excel can adjust. A single cell that is deleted has nothing to adjust to, so it becomes #REF!.
Is #REF! the same as #N/A?
No. #N/A means a lookup found no match while the formula is intact. #REF! means the formula itself points at something that is gone.
Download the practice workbook
The same data as this tutorial, with empty answer cells and a Solutions sheet.