How to fix the #REF! error in Excel

#REF! means the formula points at a cell that is not there. It is not a typo in a function name. A misspelled function is #NAME?, which How to fix the #NAME? error in Excel walks through on SUMM and on an unquoted TX. It is not a missing match. A missing match is #N/A.

Row 5 of a four-row list

The INDEX page uses four prices. Whole milk is $3.49, eggs are $4.29, oat milk is $4.79, and bread is $3.19. Row 3 of B2:B5 is oat milk.

INDEX
=INDEX(B2:B5,5)
=INDEX(B2:B5,5)E3
Row 5 of four prices
ABCDE
1ItemPriceAskResult
2Whole milk3.4934.79
3Eggs4.295#REF!
4Oat milk4.79
5Bread3.19
A picture of the grocery list from the INDEX page. Row 3 of B2:B5 is oat milk at $4.79. Row 5 is past the range, so INDEX returns #REF!.
=INDEX(B2:B5,3)
=INDEX(B2:B5,5)

B2:B5 has four cells. Row 1 of that range is B2. Row 4 is B5, the bread. Row 5 would be B6, which is outside the range you passed, so INDEX returns #REF!. The INDEX page states that rule: a row or column number larger than the range, or a negative number, is #REF!. Counting down the whole sheet does not help. Row 1 is the first cell of the range in the formula.

A 0 is a different result. In current Excel, row 0 returns the whole column as an array. It is not #REF!.

Deleting the column the formula uses

The shelf counts on the #NAME? page are 12, 48, and 6. SUM of those three is 66, from =SUM(B2:B4).

Delete column B and the formula cannot follow the cells. Excel replaces the range with #REF!.

SUM
=SUM(#REF!)
=SUM(#REF!)B2
After the column is gone
AB
1Formula
2Was 66#REF!
A picture after column B, the on-hand counts, was deleted. The formula that added 12, 48, and 6 was =SUM(B2:B4). It is now =SUM(#REF!).
=SUM(B2:B4)
=SUM(#REF!)

The 66 is gone because the cells are gone. Undo the delete, or point SUM at the column you moved the counts to. Do not wrap the broken formula in IFERROR. That hides the missing range the same way IFERROR hides the unquoted TX on the #NAME? page.

Deleting a column to the left of the range is a different edit. =SUM(B2:B4) becomes =SUM(A2:A4) when column A goes away, and it still adds whatever is in those cells. #REF! is the case where the referenced column itself was deleted.

A sheet name that is not on the file

INDIRECT turns text into a reference. On that page the sheet is Rates, the text B6 points at the Texas statewide rate, and the result is 6.25%.

INDIRECT
=INDIRECT("Rate!B6")
=INDIRECT("Rate!B6")B3
Sheet name
AB
1AddressResult
2Rates!B66.25%
3Rate!B6#REF!
A picture of two addresses. The INDIRECT page names the sheet Rates, and B6 is the Texas rate, 6.25%. Rate!B6 drops the s, so that text is not a cell.
=INDIRECT("Rates!B6")
=INDIRECT("Rate!B6")

Rates!B6 is 6.25%. Rate!B6 is #REF! because no sheet has that name. The INDIRECT page says the same error when the text is not a cell on an open sheet, including a sheet in a closed workbook. Fix the text. A formula written as =Rates!B6, without INDIRECT, would have updated when you renamed the sheet. The text inside INDIRECT does not.

Inserting a row has the same trap, and it is not always #REF!. The text B6 stays B6 and shows whatever moved into that cell. You get a wrong rate, not an error. That is the case the INDIRECT page already shows.


More from the blog