Sub topic 15
Catching duplicates, missing keys, and unreconciled totals
Assume you know basic Excel formulas, relative and absolute references, and the layout of a simple budget or financial statement. The checks in this chapter assume a ledger on Data, assumptions on Assumptions, and a roll-up sheet with monthly totals.
A lookup can return a plausible number even when the model is wrong. A key may be missing, duplicated, or spelled differently. A SUMIFS roll-up may also omit transactions because its ranges or criteria do not cover the full source data. Build checks beside the model rather than relying on visual inspection.
Checking keys before using a lookup
A key is an identifier that should appear once, such as an assumption name or account code. Test its count with COUNTIF:
=COUNTIF(Assumptions!$B$3:$B$12, $A5)Interpret the result as follows:
| Count | Meaning | Action |
|---|---|---|
| 0 | Missing key | Add the key or correct the reference |
| 1 | Valid unique key | Use the lookup |
| 2 or more | Duplicate key | Resolve the duplicate before continuing |
A count of one does not prove that the value is correct, but it proves that the lookup key is structurally unique. You can turn the count into a visible status:
=IF(COUNTIF(Assumptions!$B$3:$B$12,$A5)=1,"OK","CHECK KEY")This prevents a duplicated assumption from being silently accepted.
Detecting missing lookup results
Use a clear fallback in XLOOKUP:
=XLOOKUP($A5,Assumptions!$B$3:$B$12,Assumptions!$C$3:$C$12,"Missing assumption")The fallback is better than displaying #N/A in a presentation sheet, but it should not hide a model issue. Add a separate key-status check:
=IF(COUNTIF(Assumptions!$B$3:$B$12,$A5)=0,"MISSING",
IF(COUNTIF(Assumptions!$B$3:$B$12,$A5)>1,"DUPLICATE","OK"))For an INDEX and MATCH lookup, wrap the formula only after deciding how missing keys should behave:
=IFERROR(INDEX(Assumptions!$C$3:$C$12,
MATCH($A5,Assumptions!$B$3:$B$12,0)),"Missing assumption")IFERROR catches many errors, so use it carefully. It can also conceal a misspelled range or a broken formula. A dedicated count check makes the cause visible.
Reconciling a monthly roll-up
A reconciliation compares an independently calculated total with the source total. Suppose C10:N10 contains monthly totals created with SUMIFS, and column F contains the source amounts:
=ROUND(SUM(C10:N10)-SUM(Data!$F$2:$F$5000),2)A result of zero means the totals agree to two decimal places. A nonzero result means that rows may be missing, duplicated, assigned to an unexpected month, or included in one calculation but not the other.
Common causes include:
- The roll-up range ends before the last source row.
- A date contains a time value and fails an inclusive date test.
- An account name has trailing spaces or inconsistent spelling.
- A transaction falls outside the displayed month columns.
- One formula uses a different sign convention.
The check should compare like with like. If the roll-up covers only operating expenses, reconcile it to an operating-expense source total, not to the entire ledger.
Choosing the right check
Use COUNTIF for key integrity, an explicit not-found result for lookup visibility, and a reconciliation formula for totals. These checks test different failure modes. Passing one does not imply that the others pass.
Exercise
An assumption lookup returns a value, but the key count is 2 and the monthly roll-up differs from the source by 150. What should you do first?
Show answer
Flag the duplicate key, identify which assumption row is authoritative, then investigate the 150 difference after the key issue is resolved. A returned value does not prove that the model is valid.