Circular Dependency Detected in Google Sheets
Fix 'Circular dependency detected' in Google Sheets by correcting self-referencing SUM formulas, linked cells, running balances, and ARRAYFORMULA ranges.
On this page
The sales total in B6 shows #REF!. The error message is “Circular dependency detected. To resolve with iterative calculation, see File > Settings.”
Enter this sample in A1:B6, and leave B6 empty until you add the total.
| Row | A | B |
|---|---|---|
| 1 | Rep | Sales |
| 2 | Maya | 1200 |
| 3 | Jon | 950 |
| 4 | Priya | 800 |
| 5 | Wei | 1420 |
| 6 | Total |
You entered this formula in B6:
=SUM(B2:B6)
The last cell in the range is the problem. B6 contains the formula, but the formula also asks Google Sheets to include B6 in the sum. Sheets cannot finish the calculation without already knowing the result, so B6 returns #REF! with the message above.
Replace it with:
=SUM(B2:B5)
B6 now returns 4370, the sum of the four sales amounts. The formula reads only the source values and no longer includes itself.
This is the first thing I’d check when a total suddenly produces a circular dependency error: does the selected range extend into the cell holding the formula?
When the SUM range includes its own cell
A circular dependency doesn’t require an obviously recursive formula such as =B6+1 (that formula in its own cell also returns #REF! with the same message). It also occurs when a formula refers to itself through a range.
In the sales example, the calculation follows this path: B6 needs the sum of B2 through B6; that sum includes the value of B6; and B6 cannot produce its value until the sum finishes. There’s no independent starting value, so the calculation loops back to itself.
This mistake often happens when you select an entire column for a total, or extend a SUM range one row too far. Putting the following formula in B6 creates the same #REF! and the same message:
=SUM(B:B)
The whole-column reference includes B6. If you want to keep the total at the bottom of the sales data, use a range that ends above it.
Moving the total to another column also works, provided the formula cell isn’t inside the range it sums. With the four sales amounts still in K2:K5, =SUM(K2:K6) entered in L6 returned 4370.
A tax calculation that points back to its total
Sometimes the formula doesn’t mention its own address at all. Two different cells can create a dependency loop by referring to each other.
Add a separate calculation in columns F and G, away from the sales table:
| Row | F | G |
|---|---|---|
| 2 | List price | 100 |
| 3 | Tax | |
| 4 | Total |
Suppose G3 contains the tax formula:
=G4*0.1
And G4 contains:
=G2+G3
G3 needs G4 to calculate the tax, and G4 needs G3 to calculate the total. Neither formula can finish first, and both cells return #REF! with the same circular dependency message.
The problem isn’t multiplication or addition. It’s the direction of the references.
Assuming tax is 10% of the list price, change G3 to:
=G2*0.1
G3 returns 10. Keep G4 as =G2+G3, and it returns 110.
Now the calculation has a clear order: list price first, tax second, total third. When a formula doesn’t visibly reference itself, follow the cells it depends on until one of them leads back to the original formula cell.
Running balances that read the current row
The same mistake appears in running balances, especially when a formula is copied down a column.
Return to the sales table and add Running balance in C1. Put this formula in C2 to start the balance from Maya’s sales:
=B2
C2 returns 1200.
In C3, you want to add Jon’s sales to the previous balance. But suppose you accidentally enter:
=C3+B3
C3 refers to C3, so it depends on the value it’s supposed to calculate. Google Sheets returns #REF! with the circular dependency message rather than producing the running balance.
Use the previous row instead:
=C2+B3
C3 returns 2150. Copied down, C4 returns 2950 and C5 returns 4370.
The distinction is one row, but it changes the calculation completely. Each running-balance formula must refer to an earlier balance, not its own output. When you copy the formula down, check both the row numbers and any $ symbols, so an absolute reference doesn’t lock the calculation onto the current cell.
ARRAYFORMULA reading the column it fills
Column-wide formulas introduce another version of the problem.
Suppose you want to double every sales amount in B2:B5 and display the results in column D. Enter Doubled sales in D1. If you put this formula in D2, it references the same range where its own result belongs:
=ARRAYFORMULA(D2:D5*2)
D2 is part of D2:D5, so the formula includes its own cell in the input range. It returns #REF! with the same circular dependency message as the self-SUM, not a different array error.
The corrected formula in D2 is:
=ARRAYFORMULA(B2:B5*2)
It reads the original sales values from column B and writes the doubled values into column D: D2 = 2400, D3 = 1900, D4 = 1600, and D5 = 2840.
The important separation is between the input range and the output range. The formula should read the sales data, not the cells it’s trying to populate.
This isn’t the same as an array result being blocked by an existing value. If Google Sheets says “Array result was not expanded because it would overwrite data,” the issue is occupied output cells, covered in Array Result Was Not Expanded.
For more complicated column calculations, ARRAYFORMULA vs MAP and LAMBDA explains the differences between those approaches. Changing functions alone won’t fix a formula whose dependency path leads back to itself.
Iterative calculation won’t repair the accidental SUM
Google Sheets points you toward iterative calculation in the error message itself: “To resolve with iterative calculation, see File > Settings.” That setting exists for spreadsheets deliberately designed to repeat a calculation. It isn’t something I’d enable just to make the error in B6 disappear.
I turned it on only in a separate new spreadsheet, with a limit of 50 iterations and a convergence threshold of 0.05. Existing #REF! cells did not change until I re-entered the formulas. After that, the accidental self-SUM did not become 4370. In one calculation pass, =SUM(B2:B6) in B6 returned 218,500, which is 4370 × 50. Editing an unrelated cell then grew B6 to 437,000. The total keeps moving because the formula never settles: each pass adds the four sales amounts on top of the previous result.
Wrapping the broken formula doesn’t help either:
=IFERROR(SUM(B2:B6),0)
With iterative calculation off, that formula in B6 still returned #REF! and the same circular dependency message. IFERROR never reached its fallback, because the wrapper is inside the loop. After I turned the setting on and re-entered the formula, it returned 218,500, not 0: there was no error left for IFERROR to catch, only the inflated total. A displayed zero would have been misleading; a displayed 218,500 is worse, because it looks like a real sales figure.
The tax loop is a different kind of trap. With the setting on, =G4*0.1 in G3 and =G2+G3 in G4 no longer showed #REF!. They settled at 11.111… and 111.111… and stayed there. That is a coherent result for tax at 10% of the total, not the 10 and 110 you get when tax is 10% of the list price. The #REF! went away, and the wrong model looked finished.
The circular ARRAYFORMULA was quieter still: after the setting was on, =ARRAYFORMULA(D2:D5*2) in D2 returned 0, 0, 0, and 0 rather than the doubled sales amounts.
A simple =L1+1 in L1 returned 50, one increment per allowed iteration. That’s consistent with the limit I set, and still not a value I’d trust in a worksheet.
The corrected sales total, =SUM(B2:B5), stayed at 4370 with the setting on. For an accidental self-SUM, a mutual tax pair, or a running balance that points at itself, fix the reference rather than changing how the spreadsheet calculates.
Excel reports a circular reference differently
The underlying problem exists in Excel as well, but the warning uses different language. I didn’t run Excel for this article; the details below come from Microsoft’s Remove or allow a circular reference.
Microsoft describes a circular reference as a formula that refers to itself, directly or indirectly, and uses a “Circular References” indicator in the status bar. The first time Excel finds one, it shows a warning; after that warning is closed, Microsoft says the cell may display 0 or the last calculated value. That is not the #REF! and “Circular dependency detected” message Google Sheets showed in this test, so don’t assume the two applications present the same cell result.
Microsoft documents finding the cells through Formulas > Error Checking > Circular References, and allowing intentional circular references with iterative calculation: File > Options > Formulas on Windows (Enable iterative calculation), or Excel > Preferences > Calculation on Mac (Use iterative calculation). For an accidental total, tax calculation, or running balance, fix the reference rather than changing workbook calculation behavior.
When #REF! isn’t a circular dependency
Not every #REF! means a formula points back to itself. An invalid reference, such as INDIRECT pointing at a sheet that doesn’t exist or OFFSET moving off the grid, can produce #REF! without a calculation loop; see How to Fix #REF! Errors in Excel.
An IMPORTRANGE permission problem is also different, as is an array formula blocked by populated output cells. If the formula doesn’t trace back to its own cell, investigate the reference, access permission, or output range instead of enabling iterative calculation.