How to Fix the #REF! Error in Excel

#REF! means a cell the formula pointed to no longer exists. The most common cause is deleting a row or column the formula referred to. If you just deleted it, press Ctrl+Z. From now on, refer to a range instead of listing cells one by one, so the formula adjusts when a column is deleted.

Formula to use

=SUM(B2:D2)

Instead of =SUM(B2,C2,D2). Deleting column C gives no #REF!

When a row or column is deleted

Delete column C from =SUM(B2,C2,D2) and the formula becomes =SUM(B2,#REF!,C2). If the file is already saved, remove #REF! from the formula and type the right cell again. A formula written as a range (B2:D2) just shrinks when a column is deleted, with no error.

When a lookup number is outside the range

If the VLOOKUP column number is larger than the number of columns in the table, or the INDEX row or column number is outside the range, you get #REF!. Widen the range or lower the number.

  • =VLOOKUP(A8, A2:D5, 5, FALSE)Only 4 columns, but column 5 asked → #REF!
  • =INDEX(B2:E5, 5, 5)Row 5, column 5 of a 4 × 4 range → #REF!

When it goes off the sheet

Moving above row 1 or left of column A with OFFSET gives #REF!. Check the number of rows and columns to move.

  • =OFFSET(A2, -5, 0)5 rows above A2 is off the sheet → #REF!

When it refers to another file

INDIRECT pointing to another workbook gives #REF! while that file is closed. Keep the referenced file open.

Try the functions used here

Change the arguments in the function playground and watch the calculation step by step.

  • VLOOKUP functionFinds a value in the first column of a table and returns a value from another column in the same row.
  • INDEX functionReturns the value at a given row and column position inside a range.
  • OFFSET functionPoints to the cell (or range) a given number of rows and columns away from a reference cell.
  • INDIRECT functionTurns address text such as "C5" into a real reference and returns that cell's value.
  • SUM functionAdds all the numbers. Text and blank cells are skipped.

FAQ

How do I find every #REF! cell?
Press Ctrl+F, enter #REF! in Find what, set Look in to Formulas and click Find All.
Can I hide it with IFERROR?
#REF! means the formula is broken, so hiding it makes wrong results easy to miss. Fix the reference first.

More guides