Sub topic 1
Why Interest Creates a Circular Reference
Most debt schedules in a financial model are calculated from left to right and top to bottom. Each cell uses numbers that were already worked out. Interest breaks this pattern. It is the first place many modelers see Excel report a circular reference warning. This chapter explains why the loop forms, how to spot it, and what it does to your workbook. Later chapters cover the fixes.
Prerequisites
This chapter assumes you can do the following:
- Build or read a simple debt schedule in a spreadsheet, with an opening balance, repayments and a closing balance.
- Follow a cash flow waterfall. Cash flow available for debt service (CFADS) is cash generated before debt payments. Interest is paid first, and what remains repays principal.
- Calculate simple interest as rate times balance.
- Read Excel formulas that use
IF,MIN,MAXandAVERAGE.
What a circular reference is
A spreadsheet recalculates by following dependencies. If cell B1 contains =A1*2, then B1 depends on A1, and Excel calculates A1 first. Excel builds a chain of such dependencies across the whole workbook and works through it in order.
A circular reference exists when that chain loops back on itself. Cell A depends on cell B, B depends on C, and C depends on A. There is no valid first cell to calculate. Each cell is waiting for another cell that is waiting for it.
The loop can be direct. Typing =A1+1 in cell A1 is the smallest possible example. In financial models it is almost always indirect and runs through several rows and sometimes several sheets. That is why modelers often do not see it coming.
The loop in a debt schedule
Take a single term loan with these inputs:
- Opening balance: 500
- CFADS: 100
- Interest rate: 8%
The model has three calculations:
- Interest is the rate times a balance.
- Repayment is the cash left after interest: CFADS minus interest.
- Closing balance is the opening balance minus repayment.
If interest is charged on the opening balance, the order is clean. Interest uses 500, then repayment uses interest, then the closing balance uses repayment. Nothing points backward.
Now suppose interest is charged on the average of the opening and closing balances. This is a common choice because debt is repaid through the year, so the average is a fairer estimate of what was actually outstanding. The interest formula now needs the closing balance. The closing balance needs the repayment. The repayment needs the interest. The chain has closed.
The opening balance sits outside the loop. It is known at the start of the period, because it is the previous period's closing balance. Only the three boxes in the cycle are tangled together.
The formulas that cause it
Here is the schedule written as Excel formulas, with named cells for readability.
Interest: =Rate*AVERAGE(Debt_Open, Debt_Close)
Repayment: =MIN(Debt_Open, MAX(0, CFADS - Interest))
Debt_Close: =Debt_Open - RepaymentRead them as a dependency list:
InterestreadsDebt_Close.Debt_ClosereadsRepayment.RepaymentreadsInterest.
Enter these into a fresh workbook with iterative calculation switched off, and Excel shows a warning that there are one or more circular references. It also usually displays 0 in the affected cells.
The MIN and MAX in the repayment formula do not cause the loop. They cap the repayment so it cannot be negative and cannot exceed the debt outstanding. The loop comes from Interest reading Debt_Close.
Finding the loop with a dependency check
You can treat the model as a graph. Each cell is a node, and an arrow runs from a cell to each cell it reads. A circular reference is a cycle in that graph. The Python function below finds one. It is not something you would run on a real workbook, but it makes the idea concrete and shows that a loop is a property of the dependencies, not of the numbers.
def find_cycle(deps):
"""Return one dependency cycle as a list of names, or None."""
visiting = []
done = set()
def visit(node):
if node in visiting:
return visiting[visiting.index(node):] + [node]
if node in done:
return None
visiting.append(node)
for dep in deps.get(node, []):
cycle = visit(dep)
if cycle:
return cycle
visiting.pop()
done.add(node)
return None
for name in deps:
cycle = visit(name)
if cycle:
return cycle
return None
average_balance = {
"Interest": ["Debt_Open", "Debt_Close"],
"Repayment": ["Debt_Open", "CFADS", "Interest"],
"Debt_Close": ["Debt_Open", "Repayment"],
}
opening_balance = {
"Interest": ["Debt_Open"],
"Repayment": ["Debt_Open", "CFADS", "Interest"],
"Debt_Close": ["Debt_Open", "Repayment"],
}
print("average balance:", find_cycle(average_balance))
print("opening balance:", find_cycle(opening_balance))The output is:
average balance: ['Interest', 'Debt_Close', 'Repayment', 'Interest']
opening balance: NoneThe only difference between the two dictionaries is one entry. In the average-balance version, Interest lists Debt_Close as a precedent. Removing that single arrow removes the cycle.
The loop is real, not a mistake
It is tempting to think a circular reference is a modeling error. In this case it reflects something true about the situation. The interest you pay depends on how much debt you carry. How much debt you carry depends on how much you repay. How much you repay depends on the cash left after paying interest. These really are mutually dependent quantities.
The model is not asking for something impossible. The three numbers do have a consistent set of values. For the example above, interest of 37.5 works:
- Repayment is 100 − 37.5 = 62.5.
- Closing balance is 500 − 62.5 = 437.5.
- Average balance is (500 + 437.5) / 2 = 468.75.
- Interest is 8% × 468.75 = 37.5, which matches the starting guess.
The values agree with each other, so the loop has a solution. What Excel lacks, by default, is a way to find it. A normal calculation needs one cell to be settled before another can use it, and a loop offers no starting point.
A first look at how the solution is found
You can find the consistent values by guessing and correcting. This is the idea behind iterative calculation, which a later chapter develops in full.
- Guess that interest is 0.
- Repayment is then 100, and the closing balance is 400.
- The average balance is 450, so interest becomes 36.
- Using 36 as the new guess, repayment is 64 and the closing balance is 436.
- The average balance is 468, so interest becomes 37.44.
| Pass | Interest used | Closing balance | New interest |
|---|---|---|---|
| 1 | 0.0000 | 400.0000 | 36.0000 |
| 2 | 36.0000 | 436.0000 | 37.4400 |
| 3 | 37.4400 | 437.4400 | 37.4976 |
| 4 | 37.4976 | 437.4976 | 37.4999 |
Each pass moves closer to 37.5. The corrections shrink quickly, which is why the method works. Whether a given loop behaves this well is a question for the convergence chapter.
Where else the same pattern appears
Debt interest with a cash sweep is the standard example, but the same structure shows up elsewhere in models. Watch for it in these places:
- Revolving credit facilities. The amount drawn depends on the cash shortfall, and the shortfall depends on interest on the amount drawn.
- Interest income on cash. If interest is earned on the average cash balance, the closing cash balance depends on interest income, and interest income depends on closing cash.
- Fees tied to balances. A commitment fee on undrawn amounts depends on the drawn amount, which depends on cash flow after fees.
- Tax and interest together. Interest is tax deductible, tax reduces cash, and cash affects the debt balance and so the interest.
The trigger is always the same. A quantity that is calculated from a balance feeds into the cash flow that determines that balance, within the same period.
Why the order of periods matters
Circularity is a within-period problem. A closing balance in one period becoming the opening balance in the next is not circular. That link goes forward in time, and the earlier column is always finished first.
This is also why interest on the opening balance never loops. The opening balance was settled in the previous period, so the current period reads a fixed number. The loop only appears when the current period's interest reads the current period's closing balance.
What happens when the loop is left unhandled
If you leave a circular reference in a workbook with default settings, several things can go wrong:
- Excel shows a warning each time the file is opened or edited.
- The cells in the loop may show 0 or a stale value, and everything downstream of them is wrong.
- Excel can fail to recalculate other parts of the model correctly.
- A reader may not realize the numbers are unreliable, because the workbook still displays plausible-looking values.
You have three broad choices once you know the loop exists:
- Avoid it. Calculate interest on the opening balance, so no loop forms.
- Solve it. Let the spreadsheet iterate, or derive an algebraic formula that gives the consistent values directly.
- Work around it. Use a macro that copies a calculated value in and refreshes it on demand.
Each has costs in accuracy, transparency and risk. The remaining chapters take them in turn.
Summary of the key points
- A circular reference means a chain of cell dependencies that returns to its starting cell.
- Interest charged on the average balance reads the closing balance. The closing balance reads repayment, and repayment reads interest. That closes the loop.
- The loop is a true feature of the financial situation, and a consistent solution exists. In the example, interest is 37.5 and the closing balance is 437.5.
- Interest on the opening balance has no loop, because the opening balance is fixed before the period starts.
- The same pattern appears in revolvers, interest income on cash, and balance-linked fees.
Exercise
A loan has an opening balance of 800, CFADS of 150 and an interest rate of 10%, with interest charged on the average of opening and closing balances and all CFADS after interest used for repayment. Which three quantities form the circular loop, and what interest figure is consistent with the other two? Hint: write closing = 800 − (150 − interest) and set interest = 10% × (800 + closing) / 2.
Show answer
The loop is Interest, Repayment and Closing balance. Interest depends on the closing balance, the closing balance depends on repayment, and repayment depends on interest. Substituting closing = 650 + interest into the interest formula gives interest = 0.05 × (1450 + interest), so interest × 0.95 = 72.5 and interest ≈ 76.32. Repayment is about 73.68 and the closing balance is about 726.32. Check: 10% × (800 + 726.32) / 2 ≈ 76.32.
Exercise
In the dependency dictionary for the opening-balance schedule, which single change to the average-balance dictionary removed the cycle, and why does that change correspond to a real modeling decision?
Show answer
Removing "DebtClose" from the precedents of "Interest", so that Interest depends only on "DebtOpen". It corresponds to charging interest on the opening balance. The opening balance is fixed before the period begins, so interest no longer reads any cell that depends on the period's repayment.
Exercise
Your model earns interest income on the average cash balance, and closing cash includes that interest income. Is this circular? Explain in one or two sentences.
Show answer
Yes. Interest income reads closing cash through the average, and closing cash includes interest income. Interest income and closing cash therefore depend on each other within the same period.