Sub topic 5
Iterative calculation and circularity switches
This chapter assumes you can write simple formulas, understand absolute and relative references, and know what interest expense and average debt balances are. It also assumes you have read the chapter on calculation mode. Here you will learn why financial models create circular references, how Excel's iterative calculation handles them, and how to add a switch that lets you recover when the model breaks.
Why circularity appears in financial models
A circular reference exists when a formula depends, directly or through a chain of other cells, on its own result. Excel normally refuses to calculate such a loop and shows a warning.
The most common case in finance is interest on average debt. Interest expense depends on the average of the opening and closing debt balance. The closing balance depends on cash flow. Cash flow depends on net income, and net income depends on interest expense. The loop closes.
The diagram below shows the loop as a flowchart.
If you calculate interest on the opening balance only, there is no loop. That is simpler and safer, but it is less accurate when balances change a lot during the year. Many models accept the circularity for the sake of accuracy. Others avoid it on purpose. Decide this early and document it.
Turning on iterative calculation
Iterative calculation tells Excel to recalculate the loop repeatedly until the result stops changing, or until a limit is reached. Each pass uses the result of the previous pass as its starting point.
To enable it on Windows:
- Open File, then Options, then Formulas.
- Under Calculation options, tick Enable iterative calculation.
- Set Maximum Iterations. The default is 100.
- Set Maximum Change. The default is 0.001.
- Click OK.
Excel stops when either limit is met: it has run the maximum number of iterations, or no cell changed by more than the maximum change.
| Setting | Default | What it controls | Typical modeling choice |
|---|---|---|---|
| Maximum Iterations | 100 | How many passes Excel runs per recalculation | 100 is usually enough |
| Maximum Change | 0.001 | The size of change below which Excel stops | Keep small if values are in millions |
A key fact is that this setting belongs to the Excel application session, not to the workbook alone. Excel takes the setting from the first workbook you open in a session. If you then open a second workbook that needs iteration while the first one had it off, the second may show circular reference warnings. Open the circular model first, or turn the option on manually.
Another point: the setting is saved in the file, but other workbooks open in the same session follow whichever was opened first. Tell colleagues who receive your model to check this option.
The danger of silent errors
Iterative calculation hides circular references. Without it, Excel warns you when you create an accidental loop. With it on, Excel stays quiet. A formula that refers to itself by mistake can now produce a wrong number with no warning.
Treat iteration as a deliberate, limited tool. Keep the number of circular cells small and know where they are. Before you enable iteration, always check whether the model really needs it.
Errors that get stuck in the loop
A circular model has a particular failure mode. If any cell in the loop produces an error such as #DIV/0!, #REF!, or #VALUE!, that error feeds back into the loop on the next pass. It then stays there, even after you fix the cause. Every cell in the loop shows an error, and the model seems permanently broken.
This happens because each pass starts from the previous result. The error is now part of that starting point.
The cure is a circularity breaker, also called a circ switch. It is an input cell, normally 0 or 1, that cuts the loop on demand.
Building a circularity switch
First, create an input cell and give it a name such as Circ_Switch. Format it as an input, using the colour convention from earlier chapters. Then change the circular formula so that the switch can force it to zero.
=IF(Circ_Switch=1,0,AVERAGE(D10:E10)*$C$4)Here is how this formula works.
- D10 and E10 hold the opening and closing debt balances.
- C4 holds the interest rate, anchored with dollar signs so it stays fixed when you fill the formula.
- When
Circ_Switchis 1, the formula returns 0 and ignores the balances. The loop is broken, and any error in it is flushed out. - When
Circ_Switchis 0, the formula calculates average-balance interest as normal.
To recover from errors:
- Set
Circ_Switchto 1. Recalculate with F9. The errors clear. - Fix the underlying cause, for example a division by zero in an unrelated cell.
- Set
Circ_Switchback to 0. Recalculate. The model converges again.
Some modelers prefer the opposite convention, where 1 means circularity is on. Either works. What matters is that the label next to the input states clearly what each value does. A label like "Circularity breaker (1 = break loop, 0 = normal)" removes doubt.
Checking that the loop has converged
Excel stops iterating when changes are small, but small does not always mean correct. After enabling iteration, test the model.
- Change an input, such as the interest rate, and watch the closing debt balance settle.
- Press F9 several times. A converged model gives the same results on each press.
- Compare interest expense against a manual calculation using the average of the opening and closing balance.
- Add a check cell that recomputes interest from the final balances and compares it with the interest in the model. The difference should be close to zero.
If numbers keep moving with each F9, the loop may be unstable. Raise Maximum Iterations or lower Maximum Change. Also check for formulas that amplify the loop, such as a cash sweep that repays more debt than the cash allows.
Interaction with calculation mode
Iteration works together with the calculation mode you chose earlier. In Manual mode, Excel runs the iterations only when you press F9. In Automatic mode, it runs them after every edit, which can slow a large model. Some modelers use Automatic except for data tables, and recalculate tables with F9, because data tables multiply the number of iterations needed.
If you press F9 once in manual mode, Excel performs up to the maximum number of iterations. If the model still looks unsettled, press F9 again.
Common mistakes
- Leaving the circularity switch at 1 before sending the model out.
- Turning iteration on to silence a warning without finding the loop.
- Opening a second workbook first and losing the iteration setting.
- Setting Maximum Change too large for a model in millions, so Excel stops before the numbers settle.
- Creating several separate circular loops that are hard to trace. Use Ctrl+[ and Ctrl+] to trace precedents and dependents, and check how they connect.
Exercise
Your debt schedule uses =IF(Circ_Switch=1,0,AVERAGE(D10:E10)*$C$4) for interest. After a user typed text into the revenue input, every cell in the loop shows #VALUE!, even after the user restores the number. What do you do, and why did the errors persist?
Show answer
Set CircSwitch to 1 and press F9. This forces the interest formula to 0, so the loop no longer feeds the error back to itself and the errors clear. Then set CircSwitch to 0 and press F9 so the model converges again. The errors persisted because each iteration starts from the previous result, and that result contained #VALUE!, so the error kept circulating even after its cause was removed.
Exercise
You open a workbook that relies on iterative calculation while another workbook, saved with iteration off, is already open in the same Excel session. What do you see, and what is the fix?
Show answer
You will likely see circular reference warnings, because Excel takes the iteration setting from the first workbook opened in the session. Either enable iterative calculation under File, Options, Formulas, or close everything and open the circular model first.