Sub topic 11
When to Use INDEX or XLOOKUP Instead of CHOOSE
This chapter assumes you can write a CHOOSE formula, you have a scenario selector cell (C3) that MATCH converts to an index (C4), and you understand absolute references such as $C$4. Here you compare CHOOSE with INDEX and XLOOKUP and learn which one fits a given model.
The problem all three solve
A scenario switch has to pick one value from a set of alternatives. In the live case row, the Base, Upside and Downside growth rates sit in E12, F12 and G12. The selector gives you a scenario, and the formula returns the matching rate.
CHOOSE, INDEX and XLOOKUP can all do this. They differ in four ways:
- How the alternatives are supplied (as separate arguments or as a range).
- What the lookup key is (a position number or a name).
- How they behave as scenarios are added.
- How they fail when something is wrong.
CHOOSE: the baseline
CHOOSE takes an index and a list of values. It returns the value at that position.
=CHOOSE($C$4, E12, F12, G12)Each alternative is its own argument, so you type or click every cell. That has some advantages:
- The alternatives do not need to be next to each other. You can pull Base from one sheet and Upside from another.
- The formula shows exactly which cells feed the result. A reviewer can read it from left to right.
- It works in every version of Excel and in Google Sheets.
It also has costs:
- Adding a fourth scenario means editing every CHOOSE formula in the model. If you have 40 drivers, that is 40 edits, and missing one produces a silent error.
- If
$C$4is 4 and only three values are listed, CHOOSE returns#VALUE!. - The formulas get long when the scenario count grows.
INDEX: pick by position in a range
INDEX returns the value at a given position in a range. With a single row, the position is the column number inside that range.
=INDEX($E12:$G12, $C$4)This returns the same result as the CHOOSE formula. The alternatives are now one range reference, so the formula is the same length whether you have 3 scenarios or 8.
The trade-offs are the reverse of CHOOSE:
| Point | CHOOSE | INDEX |
|---|---|---|
| Alternatives | Listed one by one | One contiguous range |
| Adding a scenario | Edit every formula | Widen the range (or insert a column inside it) |
| Non-adjacent sources | Supported | Not supported without helper cells |
| Out-of-range index | `#VALUE!` | `#REF!` |
| Availability | All versions | All versions |
Inserting a column inside the range, for example between Upside and Downside, expands the range automatically. Adding a column after the last one does not. That is the main gotcha: if the new scenario sits in column H and the formulas still point to $E12:$G12, a selector value of 4 returns #REF!. A column inserted between E and G is picked up automatically, but one appended at the edge is not.
Mind the orientation
The INDEX example above uses a one-row range, so the position is read along the row. If your scenarios run down a column, for instance in B12:B14, the same call works on a column range:
=INDEX($B$12:$B$14, $C$4)With a two-dimensional block, INDEX needs both a row and a column number. In that case, give it a row number and a column number explicitly:
=INDEX($E$10:$G$20, 3, $C$4)This returns the value in the third row of the block, in the column given by the scenario index. A layout where each driver is one row and each scenario is one column lets you copy one formula down the whole driver list if the row number is also computed, for example with ROW()-ROW($E$9). Keep that trick for a layout you control. If someone inserts a row above the block, the offset can silently break.
XLOOKUP: pick by name
XLOOKUP looks up a value in one range and returns the matching value from another. You can use it to skip the MATCH step entirely. The selector name goes in directly.
=XLOOKUP($C$3, $E$11:$G$11, $E12:$G12)Here E11:G11 holds the scenario names (Base, Upside, Downside) as column headers. The formula finds the selector text in that header row and returns the value from the same position in row 12.
Advantages:
- No index cell is needed. The name goes straight to the result.
- It does not depend on the order of the scenarios. If you reorder the columns, the headers move with the values.
- It can show a fallback value when the name is not found, using its fourth argument.
=XLOOKUP($C$3, $E$11:$G$11, $E12:$G12, NA())Be careful with that fourth argument. A fallback of 0 hides a broken selector, because the model keeps running with zero growth. NA() keeps the error visible and propagates it through the outputs, which is usually what you want in a financial model.
Costs:
- XLOOKUP exists only in Excel 2021, Microsoft 365 and Google Sheets. Excel 2016 and 2019 do not have it, and a workbook sent to someone on those versions shows
#NAME?. - Every driver formula repeats the header lookup. With 40 drivers you run 40 text matches. For three scenarios this cost is negligible, but it does not scale to very large models.
- The scenario index disappears. If other parts of the model use
$C$4, such as a CHOOSE for a text label or a chart, you may still need the MATCH cell.
For older versions, the equivalent is INDEX with MATCH:
=INDEX($E12:$G12, MATCH($C$3, $E$11:$G$11, 0))This does the same job as XLOOKUP and works everywhere.
How the three fail
A reliable switch fails loudly. The table shows what each approach returns when the selector is wrong.
| Situation | CHOOSE (index in C4) | INDEX (index in C4) | XLOOKUP (name in C3) |
|---|---|---|---|
| Index is 0 | `#VALUE!` | Returns the whole row (can show a spill or the first cell, depending on the version) | Not applicable |
| Index is 4, only 3 values | `#VALUE!` | `#REF!` | Not applicable |
| Name is misspelled | `#N/A` (from MATCH) | `#N/A` (from MATCH) | `#N/A` by default |
| Index is text | `#VALUE!` | `#VALUE!` | Not applicable |
The index of 0 case deserves attention. In INDEX, a row or column argument of 0 means "the whole row" or "the whole column". With a one-row range and a position of 0, some versions return the entire range, which can spill across cells or silently return the first value. CHOOSE has no such behavior. This is one reason to keep the integrity check from the previous chapters, which flags any index outside 1 to 3:
=IF(AND(ISNUMBER($C$4), $C$4>=1, $C$4<=3), 0, 1)If you move to INDEX, replace the hard-coded 3 with COLUMNS($E12:$G12) so the check grows with the range.
Decision criteria
Use these questions in order.
- Do the alternatives live in non-adjacent places? If yes, use CHOOSE. INDEX and XLOOKUP need a single range.
- Will the scenario count change? If you expect to add scenarios, use INDEX or XLOOKUP. One range reference is easier to extend than 40 argument lists.
- Who opens the file? If anyone uses Excel 2016 or 2019, avoid XLOOKUP. Use INDEX with MATCH instead.
- Do you reuse the index elsewhere? If charts, labels or checks use the number, keep MATCH in one cell and use CHOOSE or INDEX.
- Is the scenario count fixed and small? For exactly three scenarios, with a team that reads CHOOSE easily, CHOOSE is fine.
A common house style is to use MATCH once to produce the index, then INDEX for the live case row. It keeps the single source of truth for the scenario number, works in every Excel version, and handles added scenarios by widening one range per formula.
A migration example
Suppose your model has this live case formula for growth:
=CHOOSE($C$4, E12, F12, G12)You add a "Stress" scenario in column H. With CHOOSE, you must change it to:
=CHOOSE($C$4, E12, F12, G12, H12)You must also extend the dropdown source from $B$5:$B$7 to $B$5:$B$8 and update the check cell so it allows an index up to 4. With INDEX, you change the range:
=INDEX($E12:$H12, $C$4)The change count is the same for a single driver. The difference appears when many formulas need the edit. A global find-and-replace on $G12 is risky because it can hit other cells, so many modelers prefer to define the range once with a named range and point every formula at the name. Then adding a scenario means redefining one name.
=INDEX(Growth_Row, $C$4)This only works when each driver has its own named row. For a long list of drivers, a single two-dimensional range plus a row lookup is easier to maintain.
Common mistakes
- Mixing orientations. Using a vertical range in a formula that expects the scenarios across columns returns the wrong cell with no error.
- Fixing the wrong references. In
=INDEX($E12:$G12, $C$4)the columns are locked so the range does not shift when copied across. The row is relative so the formula can be copied down. Locking the row too ($E$12:$G$12) makes every driver return the growth rate. - Leaving a hard-coded 3 in the check. After adding a scenario, the check still rejects index 4.
- Using XLOOKUP's fallback to hide errors. A silent zero is harder to find than
#N/A. - Sorting the scenario block. Sorting rows or columns of names and values can break an INDEX that depends on position. XLOOKUP is safer here, since it matches names.
Exercise
A model has scenario names in E11:G11 (Base, Upside, Downside) and a driver row in E12:G12. The selector is in C3. Write one formula that works in Excel 2016 and returns the driver value for the selected scenario without using a separate index cell. Then say what happens if the user adds a fourth scenario in column H and does not edit the formula.
Show answer
Use =INDEX($E12:$G12, MATCH($C$3, $E$11:$G$11, 0)). If a fourth scenario is added in column H and the formula is not edited, selecting it makes MATCH return #N/A, because the name is not in E11:G11. The formula shows an error rather than a wrong number. To fix it, widen both ranges to column H, or define named ranges and redefine them once.
Exercise
Your colleague replaces a CHOOSE formula with =XLOOKUP($C$3, $E$11:$G$11, $E12:$G12, 0). Why can this be a problem in a financial model, and what would you change?
Show answer
The fourth argument returns 0 when the scenario name is not found, so a misspelled or deleted scenario name makes the driver silently equal zero and the model keeps calculating with wrong values. Replace the 0 with NA() (or omit the argument) so the error stays visible, and keep a check cell that flags an invalid selector.