Sub topic 15
Building integrity checks
Prerequisites and scope
This chapter assumes you can build multi-sheet Excel workbooks and use IF, SUM, ABS and absolute references. It also assumes you know what a balance sheet and a cash flow statement contain. It covers how to design checks that tell you when a model has broken. Other chapters cover the layout and formula rules that checks depend on.
What an integrity check is
An integrity check is a calculation that compares two numbers that should agree and reports whether they do. The check does not fix anything. Its job is to make a failure visible before someone relies on the outputs.
Checks matter because a model can look fine while being wrong. A pasted value, a broken link, or an input change can leave every cell showing a number. Only a test of a relationship you know must hold will reveal the problem.
Both the FAST Standard and the ICAEW Financial Modelling Code expect checks. Under FAST they support the Transparent principle, because they let a reviewer see that the model works without tracing every formula. They also support Flexible, because you can change an input and see immediately whether the model still holds together.
Choosing what to check
Good checks test a relationship that must be true regardless of the inputs. Common examples:
- Balance sheet balance: total assets equal total liabilities plus equity in every period.
- Cash reconciliation: closing cash on the balance sheet equals closing cash on the cash flow statement.
- Roll-forward integrity: a balance's closing value equals its opening value plus movements.
- Sum of parts: a total shown on a summary sheet equals the sum of its detailed components.
- Allocation: percentages that split a cost across entities add to 100%.
- Sign and range: a balance that cannot be negative, such as a debt balance, is not negative.
- Timeline: period end dates follow period start dates with no gaps.
Avoid checks that can never fail. A check that compares a cell to itself, or compares two cells that use the same formula, proves nothing. The two sides should come from independent routes through the model. The balance check is useful because assets and liabilities are built separately.
The check row pattern
Build each check as a row on the same timeline as the calculations. Use the same formula in every column, as you do for every other row. The check returns 0 when the test passes and 1 when it fails.
F40: =IF(ABS(F38-F39)<0.001,0,1)
F41: =IF(SUM(F40:Z40)>0,"CHECK","OK")
' Row 38: Total assets
' Row 39: Total liabilities plus equity
' Row 40: Balance check flag (0 = pass, 1 = fail)Three design choices in this pattern are worth explaining.
- A tolerance instead of equality. Excel stores numbers in binary floating point. Two totals that are equal on paper can differ by a tiny fraction, such as 0.0000000001. A test of
F38=F39would fail for no real reason. Comparing the absolute difference with a small tolerance avoids false alarms. - ABS around the difference. Without it, a large negative difference would be smaller than the tolerance and pass.
- A 0/1 flag. Numeric flags can be summed. A single total tells you how many periods or tests failed. A text result such as "OK" cannot be added up.
The tolerance should be small relative to the units of the model. If you work in thousands, 0.001 means one unit of currency. If that is too coarse for your case, store the tolerance as an input rather than embedding it in each formula.
F40: =IF(ABS(F38-F39)<Inputs!$D$20,0,1)
' Inputs!D20: Check tolerance (for example 0.001)This follows the same rule as every other hardcode. A number that appears in many formulas belongs in one input cell.
Naming the checks and summarising them
A model usually has many checks, so organise them in three layers.
- Check rows sit next to the calculations they test, with a label that says what is compared.
- A checks sheet lists every check with its total flag. Each row links to the sum of one check row.
- A master check adds up all the flags and appears on the cover or outputs sheet, and ideally in the header of every sheet.
Checks!D6: =SUM(Calcs!F40:Z40)
Checks!D7: =SUM(Calcs!F52:Z52)
Checks!D8: =SUM(Calcs!F64:Z64)
Checks!D10: =IF(SUM(D6:D8)>0,"CHECK","OK")
' D6: Balance sheet balances
' D7: Cash reconciles to the cash flow statement
' D8: Debt roll-forward closesKeep the master check where the reader looks first. If it sits on a sheet nobody opens, a failure will go unnoticed.
Making failures easy to see
A check only helps if the failure is noticeable. Apply conditional formatting to the master check so that "CHECK" shows in red and "OK" in green. Use the same formatting for individual check rows. Because the flag is numeric, you can colour any cell with a value above zero.
Also decide what the model does when a check fails. Two common approaches:
- Show the failure but keep calculating. Outputs still appear, and the red flag warns the user. This is the usual choice.
- Blank or label the outputs. A summary cell displays "Model error" instead of a number. This suits models that others will use without reading the details.
Avoid stopping the model with circular blockers or macros that lock cells. They add complexity and can hide the cause.
Common errors in building checks
- Plugging the balance. Some models force the balance sheet to balance by adding a "balancing item". The check then always passes. Never use a plug to make a check pass.
- Checks that return errors. If a check refers to a cell containing
#REF!, the check itself returns an error, andSUMof the check row returns an error too. In the master check, anIF(SUM(...)>0, ...)then propagates the error. Wrap the master check withISERRORor useIFERROR(...,"CHECK")so an error is reported as a failure and not hidden. - Ranges that do not cover the full timeline. If you add columns and the sum range stops short, later periods go untested. Extend sum ranges across the entire timeline, including spare columns.
- Only checking totals. Offsetting errors can cancel in a total. Test components as well where an error would matter.
- Hardcoded results. A check cell typed as 0 always passes. Use the same-formula-per-row rule so a reviewer can scan for inconsistency.
- Too many checks. Dozens of trivial checks hide the important ones. Check what matters, and group the rest.
A robust master check looks like this:
Checks!D10: =IF(IFERROR(SUM(D6:D8),1)>0,"CHECK","OK")Testing the checks themselves
A check is only trustworthy if you have seen it fail. After building it, deliberately break the model. Overwrite a formula with a number, or add 1 to an input that feeds only one side. Confirm the flag changes to 1 and the master check shows "CHECK". Then restore the model. This takes a minute and shows whether the check can detect the error it is supposed to catch.
Repeat this test after major changes, and when a new person reviews the model.
Exercise
A balance check uses =IF(F38=F39,0,1). The model balances when you inspect it, yet the check shows 1 in some columns. Give the likely cause and a better formula. Then explain why a check that compares a cell to a copy of the same formula is not useful.
Show answer
Floating-point arithmetic leaves tiny differences, such as 0.0000000001, between totals that are equal on paper, so exact equality fails. Use =IF(ABS(F38-F39)<0.001,0,1), ideally with the tolerance held in an input cell. A check that compares a value with a copy of its own formula cannot fail, because both sides come from the same route through the model. It therefore gives no evidence that the model is correct.
Exercise
Your master check is =IF(SUM(D6:D8)>0,"CHECK","OK"). A reference in the cash check row becomes #REF!, and the master check shows an error instead of "CHECK". How do you change it so the failure is reported clearly, and what two other steps make the failure visible to the user?
Show answer
Use =IF(IFERROR(SUM(D6:D8),1)>0,"CHECK","OK") so that an error counts as a failure. Then apply conditional formatting to turn "CHECK" red, and display the master check on the outputs sheet, and ideally in each sheet header, so the user sees it without opening the checks sheet.