Sub topic 10
Interest circularity: causes, circuit-breaker switch, and iteration
This chapter assumes you can already build a balance roll-forward, calculate interest on opening, closing, and average balances, and follow a cash sweep and a revolver. It covers why average-balance interest creates a loop in the model, how to add a switch that breaks the loop, how iteration resolves it, and the errors that usually go wrong.
Why the loop exists
Interest on the average balance uses the closing balance. The closing balance depends on how much debt is repaid, and repayment depends on cash available. Cash available depends on net income, and net income depends on interest. That chain returns to its starting point:
- Interest uses the average of the opening and closing balance.
- The closing balance equals the opening balance minus the sweep (or plus a revolver draw).
- The sweep or draw depends on cash flow after interest.
- Cash flow after interest depends on interest.
A spreadsheet cannot evaluate a cell that depends on itself unless you tell it how. By default Excel shows a circular reference warning and may return zeros.
Interest on the opening balance has no loop, because the opening balance is last period's closing balance and is already known. The cost is accuracy. If a large sweep happens during the period, opening-balance interest overstates interest. If the revolver is drawn during the period, it understates interest.
The same loop appears in three places:
| Source | What feeds back |
|---|---|
| Cash sweep on a term loan | Sweep lowers closing balance, which lowers average-balance interest, which raises cash for the sweep |
| Revolver draw or repayment | Draw size depends on the cash shortfall, which includes interest on the average revolver balance |
| Interest income on cash | Average cash balance depends on net income, which includes that interest income |
The diagram shows the loop for a sweep.
A worked example
Take an opening balance of 100, a rate of 10%, and 30 of cash flow before interest. All 30 minus interest goes to the sweep.
With opening-balance interest, the interest is 10. The sweep is 30 − 10 = 20, so the closing balance is 80.
With average-balance interest, the interest depends on the closing balance, and the closing balance depends on the interest. Let I be the interest:
- Closing balance = 100 − (30 − I) = 70 + I
- I = 0.10 × (100 + 70 + I) / 2
Solving gives I = 8.947 and a closing balance of 78.947. Opening-balance interest overstated the cost by about 1.05.
When the sweep is not capped by zero or by the opening balance, the algebra has a closed form: I = r × (2 × open − cash) / (2 − r). With the numbers above this is 0.10 × 170 / 1.9 = 8.947. The closed form removes the circularity without iteration. It breaks down once a cap applies, because each MIN or MAX changes the equation. That is why most models iterate instead.
Resolving the loop by iteration
Iteration guesses the interest, computes the sweep and closing balance from that guess, recomputes interest, and repeats until the change is tiny. Spreadsheet iterative calculation does this automatically. This function does the same and adds a switch:
def solve_interest(open_bal, rate, cash_before_interest,
circ_on=True, tol=1e-9, max_iter=100):
interest = open_bal * rate # first guess uses the opening balance
if not circ_on:
sweep = max(0.0, min(open_bal, cash_before_interest - interest))
return interest, open_bal - sweep, 0
for i in range(1, max_iter + 1):
sweep = max(0.0, min(open_bal, cash_before_interest - interest))
close = open_bal - sweep
new_interest = rate * (open_bal + close) / 2
if abs(new_interest - interest) < tol:
return new_interest, close, i
interest = new_interest
raise RuntimeError("interest did not converge")
for flag in (False, True):
interest, close, n = solve_interest(100, 0.10, 30, circ_on=flag)
print(flag, f"{interest:.4f}", f"{close:.4f}", n)The output is:
False 10.0000 80.0000 0
True 8.9474 78.9474 8The loop converges quickly because each pass changes the answer by only a fraction of the previous change. Here the fraction is rate / 2 = 0.05, so the error falls by a factor of 20 per pass. Any realistic interest rate gives a fraction well below 1, so the iteration settles. The raise at the end is deliberate. A model that silently returns an unconverged number is worse than one that fails loudly.
The circuit-breaker switch
Spreadsheets add one more problem. If any cell in the loop produces an error such as #VALUE! or #DIV/0!, the error feeds back into itself and stays there even after you fix the cause. A circuit-breaker switch lets you cut the loop, clear the error, and restore the loop.
Put a single input cell on the assumptions sheet, for example Circ_Switch, with 1 for average-balance interest and 0 for opening-balance interest. Then write the interest formula like this:
Interest = Rate * IF(Circ_Switch = 1, AVERAGE(Opening, Closing), Opening)When the switch is 0, the formula no longer references the closing balance, so the loop is broken and Excel recalculates every cell from scratch. When the switch is 1, the loop is live again.
To recover from a stuck error:
- Set
Circ_Switchto 0 and recalculate. The errors should clear. - Fix the underlying problem, such as a bad input or a division by zero.
- Set
Circ_Switchback to 1.
You must also enable iterative calculation (in Excel, File > Options > Formulas > Enable iterative calculation). Common settings are a maximum of 100 iterations and a maximum change of 0.001. Tighten the maximum change if the model reports figures to many decimals, because the balance sheet check can show a small residual if the tolerance is loose.
Design choices around circularity
Circularity is a trade-off, and some teams avoid it altogether.
| Approach | Accuracy | Risk |
|---|---|---|
| Opening-balance interest | Biased when balances move during the period | None, no loop |
| Average balance with iteration and switch | Closest to actual interest | Errors can stick, iteration settings are workbook-level |
| Closed-form algebra | Exact when no cap binds | Complex formulas, breaks when caps bind |
| Average of opening and a prior-pass closing (copy-paste macro) | Close | Needs a macro and a manual refresh |
Lenders and bankers often accept opening-balance interest for annual models, where a loan is typically repaid at year-end, and use average balances for quarterly or monthly models and for revolvers, where the balance moves a lot during the period. Whichever you choose, state it in the model's assumptions so a reviewer knows why the numbers differ from a different version.
Common errors
- Switch placed in only one of several loops. Errors in the revolver loop persist while the sweep loop is off.
- Iteration not enabled. Excel warns about a circular reference and may show zeros. The model appears to work with the switch at 0 and breaks at 1.
- Loose tolerance. A maximum change of 1 (a common default for a different purpose) leaves visible residuals, and the balance sheet check fails by small amounts.
- Circularity hidden in a plug. A cash plug that references closing cash, which includes interest income on average cash, creates a loop without you noticing it. Use the formula auditing tools to trace precedents.
- No cap on the sweep. Without
MIN(opening balance, ...), the iteration can drive the closing balance negative. - Divergence from a rate above 200%. The iteration factor is rate / 2, so it only fails to converge for absurd inputs. A typo that enters 10 instead of 10% will give a factor of 5 and the iteration blows up, which is a good reason to keep the failure message in your code or a checks cell.
Exercise
A term loan has an opening balance of 200, a rate of 8%, and 50 of cash flow before interest, all swept to repay the loan. Use the closed-form formula I = r × (2 × open − cash) / (2 − r) to find average-balance interest and the closing balance. Check that no cap binds.
Show answer
I = 0.08 × (2 × 200 − 50) / (2 − 0.08) = 0.08 × 350 / 1.92 = 28 / 1.92 = 14.5833. The sweep is 50 − 14.5833 = 35.4167, which is above zero and below the opening balance of 200, so no cap binds. The closing balance is 200 − 35.4167 = 164.5833. Check: 0.08 × (200 + 164.5833) / 2 = 14.5833.
Exercise
Your workbook shows #VALUE! in every cell of the interest and sweep rows, and fixing the bad input does not clear them. What do you do, and why does it work?
Show answer
Set the circuit-breaker switch to 0 and recalculate, then set it back to 1. With the switch at 0, the interest formula uses the opening balance and no longer references the closing balance, so the loop is cut and every cell recalculates from clean inputs. Restoring the switch to 1 then restarts iteration from valid values instead of from the stored error.