Sub topic 7
What an Exact-Match Lookup Does
This chapter explains the working model behind every exact-match lookup: what goes in, what comes out, and what happens when the key is missing or repeated. The later chapters on XLOOKUP, MATCH, and INDEX build on this model.
It assumes you can enter formulas, you understand relative and absolute references, and you have seen a flat data table with one row per record. Where an Excel table or named range helps, the chapter says so, but neither is required.
The job of a lookup
A lookup retrieves one value from a list by using a key. The key is an identifier, such as an account code, a scenario name, or an assumption label. The list holds keys in one column and the values you want in another.
Financial models use lookups to keep inputs in one place. A growth rate sits on an Assumptions sheet. Every calculation that needs it asks for it by name. If the rate changes, you edit one cell.
This differs from aggregation. SUMIFS totals many rows that match a condition. A lookup returns a single value from a single row. If you expect one answer, use a lookup. If you expect zero, one, or many rows to be added together, use SUMIFS.
The three parts of an exact-match lookup
Every exact-match lookup has the same three parts.
- The lookup value. This is the key you are searching for, usually a cell such as
$A5. - The lookup array. This is the column (or row) that holds the keys. Excel searches here.
- The return array. This is the column (or row) that holds the values. Excel reads from here once it has found the key.
The lookup array and return array must be the same size and must line up row by row. If the key is in the third cell of the lookup array, the answer comes from the third cell of the return array.
Here is a small Assumptions list.
| Row | B: Key | C: Value |
|---|---|---|
| 3 | Revenue growth | 0.06 |
| 4 | Tax rate | 0.25 |
| 5 | Discount rate | 0.10 |
| 6 | Inflation | 0.025 |
With Tax rate in $A5, an exact-match lookup scans B3:B6 from the top, stops at the second cell, and returns the second cell of C3:C6, which is 0.25.
=XLOOKUP($A5, Assumptions!$B$3:$B$12, Assumptions!$C$3:$C$12, "Missing assumption")This formula finds the key in $A5 in the assumptions list and returns the matching value. If the key is absent, it returns the text Missing assumption.
The same lookup can be built from two functions. MATCH finds the position and INDEX returns the value at that position.
=INDEX(Assumptions!$C$3:$C$12, MATCH($A5, Assumptions!$B$3:$B$12, 0))Both formulas use the same model. They differ in syntax, defaults, and how they report problems.
What "exact" means
An exact match means the lookup value must equal a key in the list, with no rounding or nearest-neighbor guessing. Excel compares the two values and accepts only a full match. Several details decide whether two values count as equal.
- Case is ignored.
tax ratematchesTax Rate. - Spaces count.
Tax ratewith a trailing space is a different key fromTax rate. This is the most common cause of a lookup that "should work" but returns an error. Data pasted from other systems often carries invisible spaces. - Type counts. The number
1001and the text"1001"look the same in a cell but do not match. Account codes stored as text in one sheet and as numbers in another fail silently this way. - Wildcards depend on the function. In MATCH with match type 0, a key containing
*or?is treated as a wildcard pattern. In XLOOKUP, wildcards are on only when you set the match mode to 2. A literal asterisk in a key, such asOpex*, can therefore behave differently across functions.
Dates are numbers underneath. A date typed as 2026-01-31 and a date calculated by EOMONTH match if they hold the same serial number. A date with a time component, such as 31 January at 9:00, does not match 31 January at midnight.
What happens on a miss
A miss occurs when the key does not appear in the lookup array. Each function reports it differently.
| Formula | Result on a miss |
|---|---|
| XLOOKUP without a not-found argument | `#N/A` |
| XLOOKUP with a not-found argument | The text or value you supplied |
| MATCH with match type 0 | `#N/A` |
| INDEX with MATCH | `#N/A`, passed up from MATCH |
The #N/A error is useful. It tells you the key is absent, and it propagates into any formula that depends on it, so a broken lookup cannot quietly feed a wrong number into a total.
Be careful with fallbacks. The usual reflex is to wrap a lookup so it returns 0 on a miss. In a financial model, a growth rate of 0 looks like valid data. The model keeps running and gives a wrong answer with no warning. A visible text message, as in the XLOOKUP example above, is safer because arithmetic on text produces an error. Use a numeric default only when zero is the correct business answer for a missing key, and document that choice.
What happens when keys repeat
Exact-match lookups return the first match they find and stop. If the Assumptions list contains Tax rate twice with different values, the formula returns the upper one and never reports the second. By default, XLOOKUP searches from the top. INDEX with MATCH always does.
This is a quiet failure. The formula works, and the number looks plausible. The only evidence is a second row you did not read.
For this reason, treat a lookup list as a table with unique keys. You can verify that with a count.
=COUNTIF(Assumptions!$B$3:$B$12, $A5)This counts how many times the key appears. A result of 1 is healthy. A result of 0 is a missing key, and a result of 2 or more is a duplicate. Put this check beside each lookup, or run it once against the whole key list, and flag any result other than 1.
Duplicates are sometimes legitimate. A ledger has many rows for the same account. That is a job for SUMIFS, not a lookup. The test is simple: if you would ever want to add the matching rows together, the data is not a lookup table.
How the search works
Excel checks the lookup array one cell at a time from the top until it finds a match or reaches the end. On small assumption lists, this takes no noticeable time. On large lists repeated across thousands of cells, it can slow a workbook, because each formula repeats the scan.
Two habits keep this manageable.
- Bound the ranges to the actual list, such as
$B$3:$B$12, rather than whole columns. The list stays small, and the formula states how large the list is expected to be. - Anchor the ranges with
$signs, so the lookup array and return array stay fixed when you copy the formula down or across. Only the lookup value, such as$A5, should shift.
A frequent copy error is a range that drifts. If the lookup array is written B3:B12 without anchors, copying the formula down one row moves it to B4:B13. Keys near the top of the list then stop being found. The result is a pattern of #N/A errors that gets worse as you move down the sheet.
The flow of a lookup
The diagram below shows the decision path for a single exact-match lookup.
Common errors
- Mismatched array sizes. A lookup array of ten cells with a return array of nine cells returns the wrong row or an error. Keep both the same length.
- Text and number keys mixed. If
1001is a number in one place and text in another, the lookup misses. Convert both sides to the same type. - Invisible spaces. Clean source data with
TRIMbefore it becomes a key list, or fix it at the source. - Unanchored ranges. Add
$signs to the lookup array and return array. - Defaults that hide misses. Avoid returning 0 for a missing key unless 0 is the true answer.
- Duplicate keys. Check with
COUNTIFand remove or rename duplicates.
Exercise
An Assumptions sheet lists Tax rate in B3 and Tax rate (with a trailing space) in B8, with values 0.25 and 0.30. A formula looks up Tax rate with no trailing space, using exact match from the top. What does it return, and what check would reveal the problem?
Show answer
It returns 0.25, because the typed key matches B3 exactly and the search stops there. The second row is a different key because of the trailing space, so it is never reached and never reported. =COUNTIF(Assumptions!$B$3:$B$12, "Tax rate") returns 1 and misses the issue. Applying TRIM to the key column in a helper column and then counting, or comparing LEN with the length of the trimmed text, exposes the stray space. The fix is to clean the key list so each assumption appears once.
Exercise
Why is returning 0 for a missing growth-rate key usually worse than returning the text "Missing assumption"?
Show answer
A 0 growth rate is a valid number, so the model keeps calculating and shows a plausible but wrong result with no sign of a problem. The text value makes any dependent arithmetic produce an error, so the missing key becomes visible.