Sub topic 10
Hunting hardcodes, broken links and inconsistent formulas
This chapter assumes you can already compute the balance difference and find the first period where it breaks. It also assumes you know how to compare an imbalance with the cash flow items. Here you will work on the mechanical causes: values typed over formulas, links pointing at the wrong cell, and formulas that differ from their neighbours. You should be comfortable with relative and absolute references, and with Excel's Ctrl+` and Go To Special commands.
Why these errors hide so well
A model usually breaks in one of three ways. A formula is replaced by a number (a hardcode), a link points at the wrong cell or at nothing (a broken link), or one cell in a row follows a different rule from the rest (an inconsistent formula).
All three are silent. Excel shows no error, and a hardcode often matches the formula's result on the day it is typed. The model keeps balancing until an input changes, and then the balance check goes red in a period you did not touch.
That timing is the main clue. If the check is zero in the base case and nonzero after you flex an assumption, suspect a cell that no longer responds to its precedents.
Hardcodes
A hardcode is a typed number where a formula belongs. There are three common forms:
- A full overwrite. A forecast cell such as
G40holds1450instead of a roll-forward formula. - A plug inside a formula. For example
=F12*1.05or=D8+500, where a constant is buried in the arithmetic. - A pasted value. Someone copied a block and used Paste Values to freeze it, often to break a circular reference.
Inputs are not hardcodes. A growth rate or tax rate belongs in an assumptions area, formatted as an input (blue font is the usual convention), and referenced by every period. The problem is a constant sitting in a calculation row.
Finding them in Excel
- Select the forecast area of a statement, press F5 (or Ctrl+G), choose Special, then Constants and tick Numbers only. Every typed number in the range is selected. On a calculation sheet that holds only formulas, any hit is suspect.
- Add a helper row under a key line to test each period for a formula:
Formula test (row 41, copy across D:H):
=ISFORMULA(D40)
Count of non-formula cells in the forecast row:
=SUMPRODUCT(--NOT(ISFORMULA(D40:H40)))- To find constants embedded in formulas, press Ctrl+
to show formulas. Scan for digits that are not row references. You can also search for+500,*1.0` and similar patterns with Find in Formulas mode.
The historical columns are the exception. Actuals are legitimately typed. Keep the boundary between actuals and forecast at one visible column, and check hardcodes only to its right.
Inconsistent formulas
A row should contain one formula that is copied across. If the formula in column F differs from the formulas in E and G, something was edited by hand. The classic example is a retained earnings roll-forward where one period omits dividends. The balance sheet then drifts by exactly the dividend amount from that period onward.
Excel's A1 notation hides this, because =D40+E12-E41 and =E40+F12-F41 look different even though they are the same rule. Two aids help:
- Error checking. Under File > Options > Formulas, keep "Formula inconsistent with other formulas in the region" enabled. Cells get a green triangle. It can miss cases where several neighbours are also wrong.
- R1C1 reference style. Switch it on in the same options page. Each formula in a consistent row now reads identically, for example
=RC[-1]+RC[1]-R[1]C, so one odd cell stands out at once.
The same check can be scripted. The function below converts each formula to a relative form and reports hardcodes and cells that differ from the most common pattern. It handles single-letter columns only, and it ignores $ anchors, which is acceptable for a row that should be uniform.
import re
from collections import Counter
row = 40
formulas = {
"D": "=C40+D12-D41",
"E": "=D40+E12-E41",
"F": "=E40+F12", # dividends omitted
"G": "1450", # typed over a formula
"H": "=G40+H12-H41",
}
def to_relative(formula, col):
def repl(m):
offset = (ord(m.group(1)) - ord("A")) - col
return f"C[{offset}]R{m.group(2)}"
return re.sub(r"\b([A-Z])(\d+)\b", repl, formula)
relative = {}
for letter, text in formulas.items():
if not text.startswith("="):
print(f"{letter}{row} hardcoded value: {text}")
continue
relative[letter] = to_relative(text, ord(letter) - ord("A"))
pattern, _ = Counter(relative.values()).most_common(1)[0]
for letter, rel in relative.items():
if rel != pattern:
print(f"{letter}{row} differs from row pattern: {formulas[letter]}")Running it prints:
G40 hardcoded value: 1450
F40 differs from row pattern: =E40+F12The script reports the hardcode first because that check runs while the formulas are read. The pattern comparison runs afterwards.
Broken and misdirected links
A link is broken when it no longer points at what the author intended. There are four variants, and each needs a different check.
| Variant | What you see | How to find it |
|---|---|---|
| Deleted source | `#REF!` in the cell or in a total | Find `#REF!` in Formulas mode; Ctrl+` and scan |
| External workbook | `[Old model.xlsx]` inside a formula, stale values | Data > Edit Links; Find `[` or `.xls` in formulas |
| Off-by-one row or column | Plausible number, wrong line, for example the prior-year column | Trace Precedents (Ctrl+[) and read where the arrow lands |
| Short range | A total that misses a row added below the range | Compare a `SUM` range with the lines it should cover |
The last two are the dangerous ones, because nothing looks wrong. A SUM(D20:D27) over current assets that should end at row 28 leaves out one line. Total assets are then too low, and the balance difference equals that line's value, which is the "omitted item" signature from the earlier chapter on reading the size of the difference.
A quick link audit with trace tools
Pick the cell where the error first appears and walk backwards:
- Press Ctrl+[ to jump to a precedent, or use Formulas > Trace Precedents to draw arrows.
- Check that each arrow lands in the same column (the same period) unless the formula is a roll-forward. Roll-forwards should reach one column left for the opening balance and nowhere else.
- Press F2 on a total to see the coloured range boxes. A box that stops one row short is visible immediately.
- Use Formulas > Evaluate Formula to step through a long expression when you cannot see the fault.
A search routine
Once the first imbalanced period is known, work in a fixed order. The order is cheap to cheap-first, so each step rules things out before the expensive ones.
Limit the search to the roll-forward rows and the totals that feed the balance check: cash, retained earnings, PP&E, debt, working capital, and the sums of assets and of liabilities and equity. These rows hold most of the cells that can break the balance.
Confirming the fix
Restoring a formula is not enough. A model can balance by accident when the faulty cell happens to equal the correct value. After each fix, run two checks:
- Copy-across test. Confirm the repaired row is uniform in R1C1 view, including the first forecast column.
- Flex test. Change a major input, such as revenue growth, by a large amount and confirm the balance check stays at zero in every period. Then restore the input.
Common mistakes in the repair itself
- Fixing only the visible period. The faulty formula usually exists in later columns too. Copy the corrected formula across the whole row.
- Hiding the cell. Colouring a hardcode as an input does not make it correct. If it is not an assumption, it should be a formula.
- Breaking a circularity with a pasted value. This freezes interest or cash and produces drift when inputs change. The next chapter on circularity covers the proper approach.
- Trusting a clean error check. Excel's inconsistent-formula rule misses errors that repeat across several cells. The R1C1 and
ISFORMULAchecks catch them.
Exercise
In a four-period forecast, the balance check is zero in every period in the base case. After you raise revenue growth by 5 percentage points, the check shows a difference of 12.0 in the third period and in the fourth. A Go To Special > Constants scan of the retained earnings row finds nothing, but the same scan of the accounts receivable row finds a typed value in the third period. Explain why the base case still balanced, and what you do to fix the model.
Show answer
The typed accounts receivable value equalled the formula result under the base-case revenue, so it balanced by coincidence. Once revenue growth rose, the formula-driven cash flow and net income changed, but the frozen receivable balance did not respond. The mismatch is the amount by which the true receivable would have changed, which is why the difference of 12.0 appears in the third period and carries into the fourth. To fix it, replace the typed value with the same receivables formula used in the other periods, copy it across the row, check that the row is uniform in R1C1 view, and repeat the flex test to confirm the check is zero in all periods.
Exercise
A total assets cell contains =SUM(D20:D27), but the line for prepaid expenses sits in row 28. The balance check shows a difference of -3.5 in every forecast period, equal to the prepaid balance. Which signature from the earlier chapter does this match, and what is the correct repair?
Show answer
It matches an omitted item: total assets are too low by exactly the missing line, so the difference equals the item (here -3.5) rather than twice it. The repair is to extend the range to =SUM(D20:D28) in the first period, copy it across all forecast columns, and confirm the check returns to zero in every period.