Sub topic 1
What flags and switches do in a model
Prerequisites
This chapter assumes you can use cell references, anchor a reference with $ (such as $C$10), and copy a formula across a row. You should also know a forecast layout with periods in columns, and terms such as revenue, pre-tax income, and debt balance.
Why models use flags and switches
A flag is a cell that holds 1 or 0. A switch is a cell that selects one option from a numbered list, such as 1 for base, 2 for upside, and 3 for downside. One flag or switch can control many formulas at once. Changing that one cell changes the model's behavior without editing each formula.
Typing a different number into a formula in one period hides the logic and breaks when the formula is copied. A flag keeps the rule in one visible place.
Comparisons that return TRUE or FALSE
A comparison such as =F5>=$C$10 returns TRUE if F5 is greater than or equal to C10, and FALSE otherwise. The operators are =, <>, <, >, <=, and >=. In arithmetic, Excel treats TRUE as 1 and FALSE as 0, so a comparison can act as a flag.
Building a flag with IF
IF takes three arguments: a condition, the value when the condition is true, and the value when it is false.
=IF(F$5>=$C$10,1,0)This returns 1 when the period date in F5 is on or after the start date in C10, and 0 otherwise.
Timing flags: switching items on and off by period
A timing flag is 1 only between a start period and an end period. Put the start date in C10 and the end date in C11. Then use this formula in each period column:
=IF(AND(F$5>=$C$10,F$5<=$C$11),1,0)Multiply a line item by the flag to include it only in active periods:
=F20*F$8| Period date | Flag | Line item | Result |
|---|---|---|---|
| Jun 2027 | 0 | 500 | 0 |
| Jul 2027 | 1 | 500 | 500 |
> Callout: Use absolute references for the start and end dates ($C$10, $C$11) and a relative reference for the period date (F$5). The formula then copies across every column correctly.
Exercise
A line item in F20 should count only in periods from the start date in C10 through the end date in C11. Which formula pattern does this, and what does it return in a period outside the range?
Show answer
Use =IF(AND(F$5>=$C$10,F$5<=$C$11),1,0) as the flag, then multiply the line item by it, for example =F20*F$8. Outside the range the flag is 0, so the result is 0.