#REF!
A formula points at a cell that isn’t there any more.
- Excel error
- The fix is practised in 3 lessons
The error, and the fix
E2=VLOOKUP(D2,A2:C4,4,FALSE)
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Item | Size | Price | Find | Column 4 | Column 3 |
| 2 | Mug | Large | 9 | Bowl | ||
| 3 | Bowl | Small | 7 | |||
| 4 | Plate | Medium | 11 |
The table A2:C4 has three columns, so there is no column 4. Price is column 3.
Why it happens, and how to fix it
- A row, column or sheet it used was deleted
- Undo the delete straight away (Ctrl+Z, or Cmd+Z on a Mac). Later, rewrite the reference: the formula shows #REF! where the cell used to be.
- A formula copied off the edge of the sheet
- Copied up or left, a formula’s references move too. Above row 1 or left of column A they have nowhere to go.
- VLOOKUP asked for a column the table doesn’t have
- In VLOOKUP(D2,A2:C4,4,FALSE) the table has three columns, so column 4 is #REF!. Count from the table’s first column, or use XLOOKUP, which takes the return range itself.
- INDEX asked for a row past its range
- INDEX(B2:B5,9) asks for the ninth row of a four-row range. Check the number, which often comes from MATCH.
Questions
How do I fix #REF! after deleting a row?
Undo the delete if you can. If not, click the formula, find #REF! in it and replace it with the cell or range you meant.
Can I stop #REF! appearing?
Mostly. Use ranges rather than single cells where you can, and lookups that name their return range, like XLOOKUP, rather than a column number.
Practise the fix
Real tasks in a spreadsheet, checked on changed data, so your fix has to work on data you can’t see.
Practise it freeStop it happening
- Refer to ranges, like SUM(B2:B20): deleting a row inside a range shrinks it instead of breaking it.
- Prefer XLOOKUP to a column number: it names its return range, so a column inserted in the table doesn’t move it.
- Before deleting a column, check what uses it with Formulas › Trace Dependents.