Sub topic 4
Timing flags: switching items on and off by period
A timing flag is a row of 1s and 0s that says whether something is active in each period. Examples are a project's costs, a lease, a loan, or a bonus plan. This chapter assumes you can copy formulas across a row, anchor references with $, and read a forecast with periods in columns. It also assumes you have met the basic IF function.
Why a model needs timing flags
Suppose a new office costs 50,000 per year, but only from 2027 to 2029. You could type the cost into three cells and leave the others blank. That works until someone moves the opening date, and then you must find and retype every cell.
A timing flag removes that work. The start and end dates sit in two input cells, and a flag row compares each period to them. Every line item that depends on timing multiplies by the flag. If the dates change, the whole model updates.
Timing flags give you three benefits:
- One formula copies across the whole row, so there are no hard-coded gaps.
- The dates live in labeled input cells that reviewers can find.
- Several items can share a flag, or each can have its own.
The layout
Assume this layout, which matches the formulas below:
| Cell or row | Contents |
|---|---|
| `C10` | Start date (or start year) of the item |
| `C11` | End date (or end year) of the item |
| Row 5 | Period end dates or years, one per column starting in `F` |
| Row 8 | The timing flag, one cell per period |
| Row 20 | The line item to switch on and off |
For an annual model with years in row 5, the start and end inputs are years. For a monthly model, row 5 holds month-end dates, and the inputs are dates. The formula is the same in both cases, as long as the inputs and the timeline use the same kind of value.
Building the flag
Put this formula in F8 and copy it across:
=IF(AND(F$5>=$C$10,F$5<=$C$11),1,0)It reads in three parts:
F$5>=$C$10is TRUE once the period has reached the start.F$5<=$C$11is TRUE while the period has not passed the end.ANDis TRUE only when both are TRUE, andIFturns that into 1 or 0.
The anchoring is deliberate. F$5 keeps the row fixed but lets the column move, so each column reads its own period. $C$10 and $C$11 are fully anchored, so every column reads the same inputs.
With a start of 2027 and an end of 2029, the flag row looks like this:
| Row | 2026 | 2027 | 2028 | 2029 | 2030 |
|---|---|---|---|---|---|
| Period (row 5) | 2026 | 2027 | 2028 | 2029 | 2030 |
| Flag (row 8) | 0 | 1 | 1 | 1 | 0 |
Both comparisons use >= and <=, so the start and end periods are both included. This is an inclusive window. Write it down in the input labels, for example "First period active" and "Last period active". Otherwise a reader cannot tell whether the end period is in or out.
Applying the flag to a line item
Once the flag exists, applying it is a multiplication:
=F20*F$8Here row 20 holds the full amount, for example the annual cost you would pay if the item ran every period. The result is the amount in active periods and zero elsewhere. Anchor the row (F$8) so you can copy the formula down to other lines that use the same flag.
A common layout keeps the raw amount and the flagged amount on separate rows:
| Row | Label | Formula in column F |
|---|---|---|
| 20 | Office cost, if active | `=$C$12` (the cost input) |
| 21 | Office cost, included | `=F20*F$8` |
The model then feeds only row 21 into the income statement. Keeping both rows lets a reviewer see the underlying amount and confirm that the flag, not the amount, decides when it appears.
Variations you will need
A one-off event
Some items happen once, such as a purchase of equipment or a signing fee. Test for equality with the single date:
=IF(F$5=$C$10,1,0)Equality only works if the input date exactly matches a date in row 5. If the input is 15 March and your periods end on month-end dates, the flag is never 1, and the event silently disappears. For dates that may fall inside a period, use the overlap test below, or restrict the input to period-end dates with data validation.
An open-ended item
Often an item has a start but no end, such as a salary that continues until the end of the forecast. If you leave C11 blank, Excel treats it as 0, so F$5<=$C$11 is FALSE everywhere and the flag is all zeros. Handle the blank explicitly:
=IF(AND(F$5>=$C$10,OR($C$11="",F$5<=$C$11)),1,0)OR($C$11="",F$5<=$C$11) is TRUE if the end is blank or the period is on or before the end. The chapter on combining flags covers AND and OR in more detail. Here, note only that the blank check is a common source of all-zero flag rows.
Periods that span dates
In a monthly or quarterly model, an item that starts mid-period should still count in that period. If you have a row 4 holding period start dates and row 5 holding period end dates, test whether the periods overlap:
=IF(AND(F$4<=$C$11,F$5>=$C$10),1,0)The item is active if the period starts before the item ends and the period ends after the item starts. This returns 1 for any period that touches the window, even for one day. If you need a partial amount instead of a full amount, you need a fraction of the period, which is a different calculation from a 1/0 flag.
Counting periods since the start
You can build a second row from the first: a running counter of active periods. In F9 use =G9-style logic carefully. A simple version is:
=F8*(E9+1)This adds 1 to the previous counter when the flag is 1 and resets to 0 when the flag is 0. Put a 0 in the cell to the left of the first period (column E) so the first formula has something to read. The counter is useful for ramp-ups, such as a price that rises every year after launch.
Checking a timing flag
A flag row is easy to build and easy to get subtly wrong. Run these checks after you build one:
- Count the ones. If an item should run for three years,
=SUM(F8:J8)should return 3. Put that check in a cell next to the row. - Test the boundaries. Set the start equal to the first period and the end equal to the last. All cells should be 1. Then set the start after the end. All cells should be 0.
- Check the data types. A start date typed as text (for example
'2027-03-31) compares unpredictably against real dates. A year entered as2027and a timeline made of dates will never match. - Look for inconsistent formulas. Every cell in the row should have the same formula in R1C1 terms. In Excel, press
Ctrl+[or use "Go To Special > Row differences" to check. - Check that the same flag is applied to every related line. An item that is flagged in revenue but not in its related cost is a common error.
Putting it together
Here is a small, complete example you can type into a blank sheet. Put the years 2026 to 2030 in F5:J5, put 2027 in C10 and 2029 in C11, and put 50000 in C12. Then enter:
- In
F8, copy across toJ8:
=IF(AND(F$5>=$C$10,F$5<=$C$11),1,0)- In
F20, copy across toJ20:
=$C$12- In
F21, copy across toJ21:
=F20*F$8Row 21 should show 0, 50000, 50000, 50000, 0. Now change C11 to 2028. The 2029 cell drops to zero with no other edit. That single change of an input is what the flag exists to provide.
Common errors summarized
| Symptom | Likely cause |
|---|---|
| Whole flag row is zero | End input blank, start after end, or text dates |
| Flag is one period late or early | Input uses first-of-month while the timeline uses month-end |
| One-off event never fires | Equality test against a date that is not in the timeline |
| Flag works in one column only | Missing `$` anchors, so the references drift when copied |
| Cost appears but revenue does not | Flag applied to one line and not to its partner |
Exercise
A timeline has month-end dates in F5:Q5. The start date is in C10 and the end date in C11. The end date is left blank because the item runs until the end of the forecast. Write the flag formula for F8 so that it works when C11 is blank and when it is filled in. Then explain what goes wrong if you use the plain formula =IF(AND(F$5>=$C$10,F$5<=$C$11),1,0) with a blank C11.
Show answer
Use =IF(AND(F$5>=$C$10,OR($C$11="",F$5<=$C$11)),1,0). With a blank C11, the plain formula compares each date to 0 (a blank cell counts as 0 in a comparison), so F$5<=$C$11 is FALSE in every period and the entire flag row returns 0. The item never switches on. The OR test treats a blank end date as "no end," so only the start condition decides.
Exercise
A lease costs 12,000 per year in row 20. The flag row 8 shows 0, 1, 1, 1, 0 for 2026 to 2030. What does =F20*F$8 return for each year, and what is the total? What would the total be if the end input were changed so the flag became 0, 1, 1, 0, 0?
Show answer
The results are 0, 12,000, 12,000, 12,000, 0, a total of 36,000. With the flag 0, 1, 1, 0, 0 the results are 0, 12,000, 12,000, 0, 0, a total of 24,000. Only the end input changed, and no formula had to be edited.