Sub topic 1
What flags and switches do in a model
A financial model changes over time. A project may start in one month, a loan may be repaid when cash is available, and an analyst may compare base, upside, and downside cases. A flag is a control value, usually 1 or 0, that tells the model whether a condition is active. A switch is a control cell that selects one option from several alternatives.
This chapter assumes you know how to use cell references, copy formulas across periods, and distinguish relative references from absolute references. You should also understand a basic forecast layout with time periods in columns and common terms such as revenue, tax, cash, and debt.
Prerequisites
Before continuing, you should be able to:
- Read a formula such as
=F20*F$8. - Copy a formula across a row while keeping selected references fixed.
- Identify the period date at the top of a forecast column.
- Explain the difference between an input, a calculated value, and an output.
Why use flags and switches?
Without controls, a modeler may type special values directly into individual cells. For example, they might enter 0 in the months before a project starts and manually replace it with 1 later. This approach is difficult to review and easy to break when the project dates change.
A flag puts the rule in one formula. If the start date moves, the entire timeline updates. A switch puts the choice in one input cell. If the scenario changes, every linked calculation changes consistently.
| Control | Typical values | Purpose |
|---|---|---|
| Timing flag | `0` or `1` | Turns a line item off or on by period |
| Scenario switch | `1`, `2`, or `3` | Selects base, upside, or downside assumptions |
| Boolean comparison | `TRUE` or `FALSE` | Tests whether a condition is met |
A flag often contains a numeric result because multiplication makes it useful in calculations. Multiplying by 1 keeps a value unchanged. Multiplying by 0 removes it.
Comparisons and the IF function
A comparison tests a condition. For example, F$5>=$C$10 asks whether the period date in row 5 is on or after the start date in cell C10. The result is TRUE or FALSE.
The IF function converts that result into a value:
=IF(F$5>=$C$10,1,0)The formula returns 1 when the period has started and 0 otherwise. The first argument is the test. The second argument is the result when the test is true. The third argument is the result when the test is false.
A two-sided timing flag checks both the start and end dates:
=IF(AND(F$5>=$C$10,F$5<=$C$11),1,0)AND returns true only when both comparisons are true. This flag is 1 only between the two dates, inclusive. Copy it across the forecast columns, and each column tests its own period date.
Flags as model controls
Once the flag is calculated, use it in the related line item:
=F20*F$8If row 8 contains the timing flag, the line item in row 20 appears only when the flag equals 1. This separation improves auditability. The date rule is visible in the flag row, while the operating calculation remains simple.
Flags can also combine conditions. Multiplying two 1/0 flags acts like AND: the result is 1 only when both flags equal 1. Adding or using OR can represent alternatives, but check the result carefully. Adding two active flags can produce 2, not a binary control.
Switches for scenarios
A switch centralizes a decision. Put 1, 2, or 3 in a control cell such as C2, then select the matching assumption:
=CHOOSE($C$2,F10,F11,F12)Here, row 10 might contain the base case, row 11 the upside case, and row 12 the downside case. The absolute reference $C$2 ensures that every period reads the same scenario choice.
A flag or switch should have one clear owner, one visible purpose, and a predictable result. Later chapters will apply these controls to tax floors, debt repayment limits, and other model mechanics.
Exercise
A project runs from the date in C10 through the date in C11. What should the timing flag return for a period before C10, during the project, and after C11?
Show answer
It should return 0 before C10, 1 from C10 through C11, and 0 after C11.