DEV Community

TidyGrid Studio
TidyGrid Studio

Posted on Edited on

REF Errors in Google Sheets: Read the Message, Then Pick the Fix

This article was written with AI assistance. The out-of-range VLOOKUP and circular-reference examples, and their fixes, were run in LibreOffice Calc on a small sample table with adapted ranges; it shows different error codes than Sheets for these. The deleted-reference, spill and IMPORTRANGE examples were not run (ARRAYFORMULA and IMPORTRANGE are not available there). Sheets messages and menus were checked against Google's help pages and common Sheets guides, not in Sheets itself.

In Google Sheets, #REF! is not one error. It is a label for several different problems, and the fix depends on which one you have. The good news: Sheets tells you which one. Hover over the cell (or click it and look at the red triangle in the top-right corner) and read the message.

Here are five common cases, what each one means, and how to fix it.

1. The formula itself shows #REF! (something was deleted)

What happened: the formula pointed at cells, a column or a whole tab that has since been deleted. Sheets cannot guess where they went, so it writes #REF! straight into the formula.

Example: =SUM(B2:B20) becomes =SUM(#REF!) after column B is deleted.

Fix: click the cell, find #REF! in the formula bar, and type the correct range back in. If you deleted something by accident, Edit > Undo (or File > Version history) brings it back with the formulas intact, which is faster than retyping.

Prevent it: before deleting a column or tab, check whether other formulas use it. Searching the sheet with Ctrl+H (Cmd+Shift+H on Mac) and ticking "Also search within formulas" shows every place a tab name appears.

2. "VLOOKUP evaluates to an out of bounds range"

What happened: you asked for a column that is not inside the range.

=VLOOKUP(A2, Prices!A:C, 4, FALSE)
Enter fullscreen mode Exit fullscreen mode

The range A:C is three columns wide, so there is no column 4.

Fix: widen the range or lower the number.

=VLOOKUP(A2, Prices!A:D, 4, FALSE)
Enter fullscreen mode Exit fullscreen mode

3. "Array result was not expanded because it would overwrite data in X"

What happened: formulas like FILTER, UNIQUE, SORT, SPLIT and ARRAYFORMULA return many cells at once. They need empty space below and to the right to spill into. Something is in the way, and the message names the exact cell.

Fix: go to that cell and clear it. Watch out for cells that look empty but are not: a single space, an empty string from another formula, or an old value in white text all count as data. Select the area and press Delete to be sure.

If you cannot clear the space, move the formula to a spot with enough room, such as a new tab.

4. "Circular dependency detected"

What happened: the formula includes its own cell, directly or through another cell. The classic case is a total typed at the bottom of the column it adds up:

=SUM(B:B)    ← typed into B101
Enter fullscreen mode Exit fullscreen mode

Fix: stop the range above the formula, or put the total in a different column.

=SUM(B2:B100)
Enter fullscreen mode Exit fullscreen mode

If two cells refer to each other (B2 uses C2, C2 uses B2), click each one and follow the references until you find the loop. Sheets has an iterative calculation setting under File > Settings > Calculation, but turn it on only if you really mean the loop. For a total, it just hides the mistake.

5. IMPORTRANGE asks you to connect the sheets

What happened: the first time a file pulls data from another file with IMPORTRANGE, Google asks for permission.

Fix: click the cell and press Allow access in the box that appears. You need at least view access to the source file.

If there is no Allow access button, check the formula itself:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/FILE_ID", "Orders!A1:D")
Enter fullscreen mode Exit fullscreen mode
  • The URL (or the file ID) is in quotes.
  • The range is in quotes and includes the tab name.
  • A tab name with spaces needs single quotes inside the double quotes: "'Order list'!A1:D".

The habit that saves the most time

When you see #REF!, do not start rewriting the formula. Hover first and read the message. It tells you which problem you have, and each one has a different fix:

What you see Fix
#REF! inside the formula itself Retype the range, or undo the delete
Out of bounds range Widen the range or lower the column number
Array result was not expanded Clear the named cell
Circular dependency Move the total or shorten the range
IMPORTRANGE asks to connect Click Allow access

If you want a few ready-made formulas for everyday sheet chores (totals by category, duplicate IDs, cleaning pasted prices), we put five of them in a free template pack: Formula Fix Kit.

Top comments (0)