Sub topic 11
Scenarios and switches
This chapter shows how to let one model run several sets of assumptions without copying it or editing formulas. It assumes you have read the earlier chapters on the inputs layer, the calculations layer, and one-formula-per-row. It also assumes you are comfortable with INDEX, CHOOSE, and IF.
Why scenarios belong in the structure
A model is rarely run once. Management wants a base case, a downside, and an upside. A lender wants a stress case. Without structure, people answer these requests by saving copies of the file ("Modelv7downside_FINAL") or by typing over inputs and forgetting to restore them. Both approaches break the audit trail.
A scenario mechanism solves this inside the three-layer design:
- The scenario data are inputs, so they live on the inputs sheet.
- One selector cell chooses which scenario is active. It is also an input.
- A "live" column picks the active values. Calculations read only from the live column.
- Outputs show which scenario produced them.
The calculations layer never learns that scenarios exist. It reads the live value, whatever that value is. This keeps the formulas identical across every case, so you test one set of logic instead of three.
Building a scenario table
Lay out each scenario-dependent assumption as one row. Put one column per scenario and a "live" column beside the label.
| Row | Assumption | Unit | Live | Base | Upside | Downside |
|---|---|---|---|---|---|---|
| 6 | Scenario name | text | Base | Base | Upside | Downside |
| 7 | Revenue growth | % per year | 10% | 10% | 15% | 3% |
| 8 | COGS | % of revenue | 60% | 60% | 57% | 64% |
| 9 | Opex | currency per year | 150,000 | 150,000 | 160,000 | 150,000 |
The selector sits above the table. In the sheet below, it is cell C3, columns D to F hold the scenarios, and column C is the live column:
Inputs!C3 = 1 (selector: 1 = Base, 2 = Upside, 3 = Downside; blue input cell)
Inputs!C6 = INDEX(D6:F6, 1, Inputs!$C$3) (active scenario name)
Inputs!C7 = INDEX(D7:F7, 1, Inputs!$C$3) (live revenue growth)
Inputs!C8 = INDEX(D8:F8, 1, Inputs!$C$3) (live COGS percentage)
Inputs!C9 = INDEX(D9:F9, 1, Inputs!$C$3) (live opex)The live formulas are the same in every row. You can fill them down without edits. Calculation sheets then point at column C only, for example =D10*(1+Inputs!$C$7). No calculation formula should reference columns D to F directly. If one does, that formula ignores the selector and the model quietly mixes scenarios.
INDEX or CHOOSE
CHOOSE(selector, D7, E7, F7) also works, and many modelers know it well. It has a weakness. Every scenario cell is listed by hand in each formula, so adding a fourth scenario means editing every live formula. INDEX over a range grows more simply: extend the range and the table. Use INDEX unless you have exactly two or three cases and want formulas that read as plain text.
Avoid OFFSET and nested IF chains for selection. OFFSET is volatile, so it recalculates on every change and makes large models slow. Nested IF chains are hard to extend and easy to get wrong.
Selector hygiene
The selector is the most powerful single cell in the model. Treat it with care.
- Put it on the inputs sheet, not on the outputs sheet. A selector on the outputs sheet is an input hiding in the wrong layer.
- Restrict it with data validation, either a whole number from 1 to 3 or a drop-down list. If you use a drop-down of names, convert the name to a number with
MATCHin one helper cell, and let everything else use that number. - Format it as an input (blue font, input fill) so nobody mistakes it for a result.
- Show the active scenario name at the top of every outputs page. A printed table with no scenario label cannot be interpreted.
Data validation can be bypassed by pasting over a cell, so back it with a check. The following check fails if the selector is not a whole number inside the valid range:
Checks!C4 = IF(AND(Inputs!$C$3>=1, Inputs!$C$3<=3, Inputs!$C$3=INT(Inputs!$C$3)), 0, 1)It follows the pattern from the integrity checks chapter: 0 means pass, 1 means fail, and the master check sums them.
Switches
A scenario replaces a set of assumptions. A switch turns a feature or a calculation path on or off. Typical switches include:
- Include or exclude a planned acquisition.
- Apply or skip a financing fee.
- Use straight-line or declining-balance depreciation.
- Include or exclude one-off items.
Store switches as 1 or 0, with a label that states what 1 means. Do not use text such as "Yes" in formulas, because spelling and case differences cause silent failures.
Inputs!C14 = 1 (switch: 1 = include acquisition, 0 = exclude)
Calc!E30 = Inputs!$C$15 * Inputs!$C$14 (acquisition revenue = input amount × switch)Multiplying by the switch is usually better than wrapping a formula in IF(switch=1, ..., 0). The formula stays one expression, and the switch's effect is easy to see. Use IF when the two branches are genuinely different calculations, such as two depreciation methods, and keep both branches visible in the same row.
Keep switch effects local. A switch should change one block of the calculation and its dependents. If a single switch needs edits in fifteen places, the design is wrong. Put the switched logic in one row, and let other rows read that row.
Scenarios or switches?
| Question | Use a scenario | Use a switch |
|---|---|---|
| Changes many numeric assumptions together | Yes | No |
| Turns a feature on or off | No | Yes |
| Needs a named case that stakeholders recognize | Yes | Rarely |
| Changes the structure of a calculation | No | Yes |
A switch can also be part of a scenario. For example, the Upside case can set the acquisition switch to 1 by adding a switch row to the scenario table. The live column then supplies the switch like any other input.
The same idea in code
The pattern is the same outside a spreadsheet. This program keeps scenarios as data, selects one, and passes a single live dictionary to a calculation function that knows nothing about scenarios. It runs as shown.
SCENARIOS = {
"Base": {"growth_rate": 0.10, "cogs_pct": 0.60, "opex": 150_000},
"Upside": {"growth_rate": 0.15, "cogs_pct": 0.57, "opex": 160_000},
"Downside": {"growth_rate": 0.03, "cogs_pct": 0.64, "opex": 150_000},
}
FIXED = {"revenue_year1": 1_000_000, "tax_rate": 0.25, "years": 3}
SWITCHES = {"include_one_off_cost": 0}
ONE_OFF_COST = 40_000
def live_inputs(name):
if name not in SCENARIOS:
raise ValueError(f"Unknown scenario: {name!r}")
return {**FIXED, **SCENARIOS[name], **SWITCHES}
def calculate(inp):
rows = []
revenue = inp["revenue_year1"]
for year in range(1, inp["years"] + 1):
if year > 1:
revenue *= 1 + inp["growth_rate"]
ebit = revenue * (1 - inp["cogs_pct"]) - inp["opex"]
if year == 1:
ebit -= ONE_OFF_COST * inp["include_one_off_cost"]
tax = max(ebit, 0) * inp["tax_rate"]
rows.append({"year": year, "net_income": ebit - tax})
return rows
for name in SCENARIOS:
rows = calculate(live_inputs(name))
total = sum(r["net_income"] for r in rows)
print(f"{name:<9} cumulative net income = {total:,.0f}")The unknown-name error plays the role of the selector check. A bad selector stops the run instead of producing a plausible wrong number.
Running all scenarios side by side
Sometimes you need all three results in one table, and the selector only shows one at a time. There are two common solutions.
- Paste-values macro or manual snapshot. Cycle the selector, copy the outputs, and paste them as values into a results table. The snapshot goes stale as soon as an input changes, so label it with a date and the model version.
- Data table. An Excel what-if data table with the selector as its input cell recalculates the model for each value. The results stay live and no macro is needed. Data tables slow large models, and the input cell must be on the same sheet as the table. Place the table on the inputs sheet, or mirror the selector from there.
Whichever you choose, the comparison table is an output. It contains no logic of its own beyond what the model already calculated.
Common mistakes
- Scenario values typed into calculation formulas. A formula like
=IF(Inputs!$C$3=2, 0.15, 0.10)hides assumptions in the calculation layer. Move the numbers to the scenario table. - Overrides in the live column. If someone types 12% over the
INDEXformula, the selector no longer controls that row. Flag the live column with a consistent formula and test it with a check or the "Go To Special: Constants" command. - Saved with a non-base scenario active. Reopening the file shows odd numbers with no warning. The active scenario name on the outputs page reduces this risk. Many teams also reset the selector to Base before saving.
- Too many switches. With ten independent switches there are 1,024 combinations, and you will not test them all. Keep switches few. Remove those that are no longer needed.
- Untested scenarios. The checks must pass in every scenario, not only Base. Run each one before you release the model.
Exercise
A model has a scenario table in Inputs!D7:F7 (Base, Upside, Downside growth rates) and a selector in Inputs!C3. A colleague writes the revenue formula as =D10*(1+Inputs!$E$7) so that it "uses the upside growth rate". Describe two problems with this and give the corrected design.
Show answer
First, the formula points directly at the Upside column, so it ignores the selector. Changing Inputs!C3 will not change this row, and the model silently mixes scenarios. Second, the choice of Upside is hardwired into a calculation formula, so the calculation layer now holds an assumption. The fix is to add a live cell, for example Inputs!C7 = INDEX(D7:F7, 1, Inputs!$C$3), and write the revenue formula as =D10*(1+Inputs!$C$7). Every year column should use that same formula. The scenario choice then happens only in the selector.
Exercise
Write an Excel formula for a check on Checks!C5 that returns 0 when the acquisition switch in Inputs!C14 is exactly 0 or 1, and 1 otherwise. Why is such a check useful when data validation already exists?
Show answer
=IF(OR(Inputs!$C$14=0, Inputs!$C$14=1), 0, 1). Data validation only restricts typing. Pasting values over the cell, or changing the validation settings, can bypass it. A check inside the model catches an invalid switch value and raises the master check, so the problem is visible instead of producing a wrong result such as acquisition revenue multiplied by 2.