Sub topic 8
XLOOKUP: lookup array, return array
Prerequisites and purpose
This chapter assumes you can enter Excel formulas and use relative and absolute references. You should also understand a simple assumptions table, where each key appears once and each key has one value.
XLOOKUP retrieves one value by finding a key in one range and returning the value from a corresponding range. It is useful when a model needs one assumption, rate, or label. It is different from a total function because it returns a matching record rather than adding many records together.
The working model
A lookup has three important parts:
- The lookup value is the key you want to find, such as
Tax rate. - The lookup array is the range containing possible keys.
- The return array is the range containing the values to return.
The lookup and return arrays must line up. The first item in the lookup array corresponds to the first item in the return array, the second corresponds to the second, and so on.
=XLOOKUP(lookup_value, lookup_array, return_array)Suppose the Assumptions sheet contains this table:
| Key | Value |
|---|---|
| Tax rate | 0.25 |
| Exit multiple | 8.0 |
| Revenue growth | 0.06 |
If cell A5 contains Tax rate, use:
=XLOOKUP($A5, Assumptions!$B$3:$B$12, Assumptions!$C$3:$C$12)Excel searches Assumptions!$B$3:$B$12 for the value in A5. It returns the value from the same position in Assumptions!$C$3:$C$12. In this example, the result is 0.25.
The dollar signs lock the source ranges when you copy the formula down. The row reference in $A5 can change from A5 to A6, allowing each model row to retrieve a different key.
Why aligned ranges matter
XLOOKUP uses position, not column names. If Tax rate is the fourth item in the lookup array, Excel returns the fourth item in the return array. Keep both ranges the same height and ensure that the rows have not been independently sorted.
A safer formula gives a clear result when the key is absent:
=XLOOKUP($A5, Assumptions!$B$3:$B$12, Assumptions!$C$3:$C$12, "Missing assumption")The fourth argument is the value to display when no match exists. A visible message is easier to audit than an unexplained #N/A error.
| Argument | Example | Role |
|---|---|---|
| Lookup value | `$A5` | Key to find |
| Lookup array | `Assumptions!$B$3:$B$12` | Range searched |
| Return array | `Assumptions!$C$3:$C$12` | Range supplying the result |
| If not found | `"Missing assumption"` | Clear missing-key result |
Exercise
Cell A5 contains "Revenue growth". Write an XLOOKUP formula that searches Assumptions!B3:B12, returns the matching value from Assumptions!C3:C12, and displays "Missing assumption" if the key is absent.
Show answer
=XLOOKUP($A5,Assumptions!$B$3:$B$12,Assumptions!$C$3:$C$12,"Missing assumption")