Sub topic 12
Checks and Common Mistakes
A scenario switch fails quietly. A wrong index or a mistyped name still produces a clean-looking set of numbers, and nothing turns red. This chapter adds checks that make a broken switch visible, then lists the mistakes that cause most failures.
It assumes you have built the switch from the earlier chapters: a dropdown selector in C3, an index from MATCH in C4, scenario names in B5:B7, scenario growth rates in E12:G12 (Base, Upside, Downside), and a live case value in D12. It also assumes you are comfortable with IF, AND and absolute references.
How a scenario switch breaks
Most failures fall into four groups:
- The index is invalid. MATCH returned #N/A, the cell was overwritten with a typed number, or the number is outside the range of scenarios.
- The live case does not match the selection. A CHOOSE argument is in the wrong order, or someone typed a value over the formula.
- An input is outside its allowed range. Data validation stops typing but not pasting, so a bad value can still get in.
- The structure changed. Someone added a scenario or renamed one, and part of the model still assumes the old layout.
Each group gets its own check cell. The check cells share one convention: 0 means pass and 1 means fail. This lets one master check add them up.
Check 1: the index is valid
The spine formula tests that the index is a number from 1 to 3:
=IF(AND(ISNUMBER($C$4), $C$4>=1, $C$4<=3), 0, 1)This formula has a gotcha. If C4 contains #N/A, then $C$4>=1 also returns #N/A. AND returns an error when any argument is an error, so the check returns #N/A instead of 1. The failure still shows, but as an error that spreads into any total built from the checks. Test with ISNUMBER first in a nested IF, because IF only evaluates the branch it needs:
=IF(ISNUMBER($C$4), IF(AND($C$4>=1, $C$4<=ROWS($B$5:$B$7), $C$4=INT($C$4)), 0, 1), 1)This version makes two changes:
- The upper bound is
ROWS($B$5:$B$7)instead of a typed 3. If you add a fourth scenario name to the list, the bound follows. - The whole-number test
$C$4=INT($C$4)catches an index of 2.7. CHOOSE silently truncates 2.7 to 2, so a fractional index would give a valid-looking wrong answer.
Check 2: the selector names a real scenario
The selector can hold a name that is not in the list. A paste can put it there, and so can a renamed scenario. Test it directly with the same MATCH the model uses:
=IF(ISNUMBER(MATCH($C$3, $B$5:$B$7, 0)), 0, 1)This overlaps with Check 1, because a failed MATCH also makes the index invalid. Keep both anyway. Check 2 tells you the selector text is wrong. Check 1 tells you the index is wrong. If only Check 1 fails, someone has overwritten C4, and the selector is fine.
Check 3: the live case equals the chosen scenario
This check catches a mis-wired live row. The live row uses CHOOSE:
=CHOOSE($C$4, E12, F12, G12)Compare it with INDEX on the same block. INDEX is a different function, so it does not share the CHOOSE formula's wiring mistakes:
=IFERROR(IF(ABS(D12-INDEX($E12:$G12, $C$4))<0.000001, 0, 1), 1)The comparison uses a small tolerance instead of =. Spreadsheets store numbers in binary floating point, so two calculations that look equal can differ in the last digit. IFERROR turns any error, such as a bad index or text in D12, into a failure flag of 1.
Run this check on every driver row, not only revenue growth. A model with eight drivers needs eight copies of it, or one check per row summed into a single cell.
A hardcoded number typed over D12 is caught by this check only when the typed number differs from the selected scenario. If the typed value equals the current scenario's value, the check passes, and the model breaks later when you switch scenarios. To catch that case, cycle through all three scenarios once and read the master check each time (see the section on testing the switch).
Check 4: inputs are inside their allowed range
The custom validation rule on the growth cells accepts only numbers between -50% and 100%:
=AND(ISNUMBER(E12), E12>=-0.5, E12<=1)Validation guards typing only. Pasting, filling a range and importing from another workbook all skip it. A check cell tests the values that are actually in the cells:
=IFERROR(IF(AND(COUNT($E12:$G12)=3, MIN($E12:$G12)>=-0.5, MAX($E12:$G12)<=1), 0, 1), 1)COUNT counts only numeric cells, so a growth rate stored as text lowers the count and fails the check. Text is the likeliest bad paste, for example "5%" copied from a PDF.
The master check
Put the checks in one block and add them up. A possible layout:
| Cell | Label | Formula result |
|---|---|---|
| C20 | Index is valid | Check 1 |
| C21 | Selector name is on the list | Check 2 |
| C22 | Live growth equals chosen scenario | Check 3 |
| C23 | Growth inputs inside range | Check 4 |
| C25 | Master check | `=IF(SUM($C$20:$C$23)=0, "OK", "CHECK")` |
Link the master check to the top of the model, next to the selector, so the person changing scenarios sees it. Conditional formatting that turns the cell red when it does not read "OK" helps readers who skim.
Testing the switch by hand
Checks cannot find every problem, so test the switch once before sharing the model:
- Set the selector to Base and note the master check and one headline output, such as year-5 revenue.
- Set it to Upside, then Downside, and record the same output each time.
- Confirm the outputs differ, and in the direction you expect. Upside revenue should be higher than Base, and Downside lower.
- Type a name that is not on the list into C3. If validation blocks it, paste the text in instead. The master check should show "CHECK".
- Return the selector to the scenario you want to ship.
If two scenarios give identical outputs, something downstream is not linked to the live row. That is the most common wiring fault, and no check cell can find it. Only changing the selector shows it.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Typing the index into CHOOSE, such as `=CHOOSE(2, E12, F12, G12)` | The model is stuck on Upside and the selector does nothing | Reference the index cell: `$C$4` |
| CHOOSE arguments in a different order from the columns | Selecting Upside returns the Downside value | Keep columns and arguments in the same order as the name list |
| Writing `C4` instead of `$C$4`, then copying the formula down | The reference slides to C5, C6 and so on, and later rows read blank cells | Anchor the index with `$C$4`, or name it |
| Leaving out the 0 in `MATCH(C3, B5:B7)` | The default match type 1 assumes sorted data and can return a wrong index | Always write `MATCH($C$3, $B$5:$B$7, 0)` |
| Trailing space in a scenario name, such as "Base " | The name looks right but MATCH returns #N/A | Build the dropdown from the list cells so the text is identical, and use Check 2 |
| Renaming a scenario in the list but not in the selector | The selector still holds the old name | Re-select the scenario from the dropdown after any rename |
| Adding a scenario to the list but not to CHOOSE | Selecting it returns #VALUE! because the index exceeds the argument count | Add the new argument to every CHOOSE, or switch to INDEX over a range |
| Hardcoded numbers typed over live-row formulas | The row stops responding to the selector | Format formula cells differently from input cells and run Check 3 |
| Percentages stored as text | The check on inputs fails, or calculations treat the value as zero | Re-enter the number and use the validation rule |
The rename problem in detail
Renaming is the mistake that causes the most confusion, because the dropdown source is a range of cells and the selector holds a copy of the text. Suppose you rename "Downside" to "Downside case" in B7. The selector still reads "Downside". MATCH can no longer find it, the index becomes #N/A, and every output that depends on the live row turns into an error. Check 2 and the master check show the failure at once. The fix is to pick the new name from the dropdown again.
Why lists with a fixed length are risky
CHOOSE needs one argument per scenario, typed into every formula. A model with 20 drivers has 20 CHOOSE formulas, and adding a scenario means editing all 20. A missed edit raises an error only when the new scenario is selected, so it can survive testing in the old scenarios. With the INDEX version, the same change is a wider range reference, and a range-wide check can verify the width.
=INDEX($E12:$G12, $C$4)If you expect more than three scenarios, use INDEX. If the count stays at three, CHOOSE is fine, and its argument list makes each scenario's source cell visible in the formula.
A short review routine
Before you hand over a model with a scenario switch, work through this list:
- The master check shows "OK" in all three scenarios.
- The headline outputs differ between scenarios, in the expected direction.
- Every driver has a live-row check, or one sum-check covering all live rows.
- No formula outside the live row refers to the scenario columns.
- Selector, index and checks are visible on the same screen.
Exercise
A colleague adds a fourth scenario, "Stress", to the list in B8 and extends the dropdown to B5:B8. Selecting "Stress" now turns the live case row into #VALUE!. The master check, built from the formulas in this chapter, still shows "OK" when the selector is on Base. Explain the cause, and say which change to the check formulas would make the model fail visibly before anyone selects "Stress".
Show answer
The live-row CHOOSE formulas still have three arguments (E12, F12, G12). MATCH returns 4 for "Stress", and CHOOSE with index 4 and only three arguments returns #VALUE!. The checks all use ranges or counts tied to $B$5:$B$7 or $E12:$G12, so with Base selected they pass. The bound in Check 1 should be ROWS of the full name list, extended to $B$5:$B$8. Once the list is longer than the scenario columns, a width check will fail, for example a new cell that flags 1 when ROWS($B$5:$B$8)<>COLUMNS($E12:$G12), added to the master check. The real fix is to add a fourth column and a fourth CHOOSE argument, or to move the live row to INDEX over the wider range.
Exercise
Check 3 compares the CHOOSE result with INDEX using ABS(D12-INDEX($E12:$G12,$C$4))<0.000001 instead of D12=INDEX($E12:$G12,$C$4). Why, and what does the IFERROR around it do?
Show answer
Spreadsheets store numbers as binary floating-point values, so two results that should be equal can differ in the last digits, and an exact = comparison can then return FALSE for no real reason. A small tolerance avoids those false failures. The IFERROR turns any error (an invalid index from INDEX, or text in D12 inside ABS) into the failure flag 1 instead of letting an error value flow into the master check sum.
Exercise
The index cell C4 contains 2.7. What does =CHOOSE($C$4, E12, F12, G12) return, and which part of Check 1 catches it?
Show answer
CHOOSE truncates the index to the whole number 2, so it returns the value in F12 (Upside), with no error. The test $C$4=INT($C$4) in Check 1 is FALSE for 2.7, so the AND fails and the check returns 1.