Circular Reference Warning? How to Find and Fix the Loop

A circular reference means a formula depends, directly or through other cells, on its own result. Excel and Google Sheets flag it because they cannot work out which value to calculate first. Most of the time the fix is to find the cell that closes the loop and remove one link. Only a small number of models need the loop on purpose, and those need iterative calculation switched on with care.

What a circular reference is

A spreadsheet calculates cells in dependency order. If B1 contains =A1*2, the engine calculates A1 first, then B1. This works as long as every chain of references ends at a value that does not depend on anything else.

A circular reference breaks that chain. If A1 contains =B1+5 and B1 contains =A1*2, the engine needs A1 to calculate B1 and B1 to calculate A1. Neither can be done first.

SOP 1.1: Recognise a direct loop

A direct loop is a cell whose formula refers to itself. The most common example is a total placed inside its own range:

  • A1 to A9 hold expense values.
  • A10 contains =SUM(A1:A10).

A10 includes A10, so the loop is one cell long. Excel and Sheets both detect this immediately.

SOP 1.2: Recognise an indirect loop

An indirect loop passes through two or more cells before it returns to the start. Chain example:

  • C2 contains =D2*0.1
  • D2 contains =E2+100
  • E2 contains =C2

Nothing in C2 refers to C2 directly, but the chain C2 to D2 to E2 and back to C2 is still a loop. Indirect loops are harder to find because the formulas that cause them may sit on different sheets, or may have been written years apart.

3-Statement Financial Model Kit

Skip the setup

3-Statement Financial Model Kit

Profit and loss, balance sheet and cash flow, all linked. Change one assumption and every statement updates.

See it on Taskdale →

The formulas and functions most likely to cause a loop

Some functions are responsible for more loops than others, mainly because they accept ranges and it is easy to make those ranges too wide. Knowing these patterns speeds up the search in Module 2.

  • SUM, AVERAGE and COUNT placed inside their own range. A total in A10 with a range of A1:A10 is the most common loop in spreadsheets.
  • Whole-column references. =SUM(B:B) in any cell in column B is a loop, because the range includes the formula cell.
  • Lookups that search a column containing the result. VLOOKUP or XLOOKUP pointing at a range that includes the formula’s own output column will loop when the lookup range is wide enough.
  • Running balances that reference the current row. A balance formula in C5 that refers to C5 instead of C4 has a loop. The correct form is usually =C4+B5.
  • INDIRECT and OFFSET. These functions build references as text or by offset, so a loop may only appear when specific inputs are entered. The loop is real but hidden until the sheet recalculates in a particular state.
  • Averages and interest on balances that depend on the output. These are often intentional, covered in Module 5.

A formula does not need to look wrong to create a loop. =SUM(A1:A10) in A10 looks like a normal total to most readers, which is why the warning is often the first sign.

Fixing the loop

Once you have the cells, choose one of four fixes. Each removes the loop, but they differ in how much they change the model.

SOP 4.1: Correct the range

This is the fix for most accidental loops. Change the range so it stops before the formula cell.

  • Change =SUM(A1:A10) in A10 to =SUM(A1:A9).
  • Change =SUM(B:B) in column B to =SUM(B2:B500), adjusting the end row to the real data.

Correcting the range is quick and low risk. The main risk is that the new range misses rows that were added later. Check the row count against the source data before closing the file.

SOP 4.2: Reference the prior period

Running balances and time-series models usually need to read the previous row or period, not the current one. Change the reference to point one row or column back. This is often the correct fix for a balance column where each row should build on the one above.

SOP 4.3: Move the output off the input sheet

Some loops happen because an input sheet pulls results from an output sheet, and the output sheet reads the input back. Move the calculated values to a separate calculation sheet, and make the input sheet hold only typed values and direct links that do not feed back. This takes longer but prevents the same loop from returning.

SOP 4.4: Replace the loop with an algebraic solution

In some models, a loop exists only because a formula was written as a sequence of steps. Solving the equations directly removes the need for iteration. Module 8 shows this with a worked example.

The table below compares the four fixes.

FixBest forEffortRiskKeeps the model live
SOP 4.1: Correct the rangeTotals and lookups with wide rangesLowMissed rows if data growsYes
SOP 4.2: Reference prior periodRunning balances and time seriesLowWrong period if rows are re-sortedYes
SOP 4.3: Move output off input sheetMulti-sheet models with feedbackHighBroken links during restructureYes
SOP 4.4: Algebraic solutionInterest and tax on balancesMediumHarder for others to auditYes

When a circular reference is deliberate

Some models need a loop. The most common case is interest calculated on an average balance, where the closing balance depends on interest and the interest depends on the closing balance. Tax on profit after a tax deduction and certain cash sweep models behave the same way.

For these models, the spreadsheet can be told to calculate the loop repeatedly until the values settle.

SOP 5.1: Enable iterative calculation in Excel

  1. Go to File, then Options, then Formulas.
  2. Tick Enable iterative calculation.
  3. Set Maximum Iterations. The default is 100.
  4. Set Maximum Change. The default is 0.001.

Excel repeats the loop up to the maximum iterations, stopping early if the change between passes falls below the maximum change. Excel takes this setting from the first workbook opened in a session, so a file can calculate differently depending on what was opened before it. Check the setting each time you open a model.

SOP 5.2: Enable iterative calculation in Google Sheets

  1. Go to File, then Settings, then Calculation.
  2. Tick Iterative calculation.
  3. Set the maximum number of iterations and the minimum change. Use the defaults unless the model requires otherwise.

SOP 5.3: Build a circuit breaker

An iterative model can produce a #NUM! or #DIV/0! error, and once an error enters the loop, it stays there. A circuit breaker is a single input cell, usually labelled “Circularity switch,” that multiplies the loop by 1 when the model should iterate and by 0 when it should reset.

For example, interest becomes =Switch*Rate*AVERAGE(Open,Close). When the switch is 0, interest is 0 and the loop clears. Set it back to 1 once the errors have gone. Every model that uses iteration should have one.

Trade-offs of iteration

Iteration is useful when the model needs the loop, but it changes how you should trust the output.

  • Convergence is not guaranteed. Some loops oscillate and never settle. The warning disappears only because the iteration limit was reached.
  • Errors spread. One bad input can travel through the loop and corrupt every value in it.
  • Audit is harder. Reviewers may not know which values are settled and which are still moving.
  • Results depend on settings. Changing the maximum change can alter outputs in the third or fourth decimal place, which matters for reconciled figures.
Stonepath Business Plan Kit

Ready-made template

Stonepath Business Plan Kit

A Word business plan plus an Excel model for sales, costs, break-even and three-year projections.

See it on Taskdale →

Common mistakes

Most mistakes come from treating the warning as the problem rather than the symptom.

  • Enabling iteration to make the warning disappear. This hides the loop and leaves any accidental circularity in place. Use iteration only after confirming the loop is intentional.
  • Wrapping the formula in IFERROR. This suppresses the error message but does not break the loop. The formula still calculates in a circle, and the wrapped value may be wrong.
  • Fixing one cell and recopying the original formula. If a formula was copied down a column, the same loop will return in every row that carries it. Fix the source, then copy again.
  • Assuming the flagged cell is the cause. The status bar shows one cell in the loop. The formula that needs changing may be one or two steps upstream.
  • Forgetting the setting belongs to the session. A model that works on one machine may show incorrect values on another if iteration is set differently.
  • Ignoring the warning in a shared file. Other users may not see the same warning if their setting differs, and they may trust figures that have not settled.

Worked example

A small business has a loan of 10,000 with a monthly payment of 300. The monthly interest rate is 0.5 per cent. The model charges interest on the average balance during the month, which is the more accurate method for many loan agreements.

The layout is as follows.

  • B2: Opening balance, 10,000
  • B3: Monthly payment, 300
  • B4: Monthly rate, 0.005
  • B5: Interest, =B4*AVERAGE(B2,B6)
  • B6: Closing balance, =B2+B5-B3

Interest in B5 depends on the closing balance in B6. The closing balance in B6 depends on interest in B5. The loop is B5 to B6 and back to B5.

Step 1: Confirm the loop

Excel shows the circular reference warning and reports B5 or B6 in the status bar. Trace precedents from B5 confirms the arrow to B6, and trace precedents from B6 confirms the arrow back to B5.

Step 2: Decide whether the loop is needed

The lender calculates interest on the average balance, so the loop reflects the real method. Removing it would change the answer. The decision is to keep the calculation but make it solvable without iteration.

Step 3: Solve the equations

Let I be interest and C be the closing balance. The two equations are:

  • I = 0.005 × (10,000 + C) / 2
  • C = 10,000 + I − 300

Substitute the second into the first and collect the terms in I. The result is:

I = (r ÷ 2) × (2 × Opening − Payment) ÷ (1 − r ÷ 2)

With r = 0.005, Opening = 10,000 and Payment = 300, the calculation is:

  • r ÷ 2 = 0.0025
  • 2 × Opening − Payment = 19,700
  • Numerator = 0.0025 × 19,700 = 49.25
  • Denominator = 1 − 0.0025 = 0.9975
  • Interest = 49.25 ÷ 0.9975 = 49.37

The closing balance is 10,000 + 49.37 − 300 = 9,749.37.

Step 4: Replace the loop

Rewrite B5 as a single formula with no reference to B6:

=(B4/2)*(2*B2-B3)/(1-B4/2)

Set B6 to =B2+B5-B3, which now reads a value that does not depend on itself. The warning clears, and the interest result matches the iterative answer of 49.37.

Step 5: Compare with the simpler method

Charging interest on the opening balance gives 0.005 × 10,000 = 50.00. The difference is 0.63 a month, or about 7.56 over a full year at this balance, and it shrinks as the balance falls. Whether that difference matters depends on the agreement. If the lender uses average balance, the algebraic version is the correct one.

Step 6: Check the result

Recalculate with a second payment amount, such as 500, and confirm that the closing balance matches a manual calculation. Then test the circuit breaker from SOP 5.3 if the model still uses iteration elsewhere. Record the method in the model’s notes so the next reviewer knows why the formula looks unusual.

Decision rule and checklist

Use this rule when the warning appears: if the loop has no business reason, remove it by correcting the range or the reference. If the loop reflects the real calculation, solve it algebraically where you can, and use iteration with a circuit breaker only where you cannot.

Checklist:

  1. Record the cell address from the warning or the #REF! error.
  2. Trace precedents until the loop closes.
  3. Confirm whether the loop is accidental or required by the method.
  4. Correct accidental loops with SOP 4.1 or SOP 4.2.
  5. Solve required loops with SOP 4.4 where a closed form exists.
  6. Enable iteration only when no closed form exists, and add a circuit breaker.
  7. Check the iteration setting on the machine that will open the file.
  8. Recheck every formula copied from the fixed cell.
  9. Test the result with a second set of inputs before sharing the file.
Lapis Ledger Annual Budget

Get the finished file

Lapis Ledger Annual Budget

Monthly and annual budget tabs for Excel and Google Sheets, with category totals that add themselves up.

See it on Taskdale →

Scroll to Top