Sub topic 13
Looking up by row and column together
This chapter assumes you know basic Excel formulas, relative and absolute references, and the layout of a simple financial model. A two-way lookup retrieves one value by matching both a row label and a column header. For example, it can find the interest rate for the Senior debt row and the 2027 column.
Set up the rate table
Keep row labels unique and put period headers in one row. For example:
| Row label | 2026 | 2027 | 2028 |
|---|---|---|---|
| Senior debt | 5.0% | 5.2% | 5.4% |
| Revolver | 7.0% | 7.1% | 7.2% |
| Mezzanine debt | 9.0% | 9.2% | 9.4% |
Suppose the table is on a sheet named Rates:
Rates!B3:B12contains the row labels.Rates!C2:H2contains the period headers.Rates!C3:H12contains the values.- The model's row label is in
$A5. - The model's period header is in
C$4.
The dollar signs make the formula easier to copy. $A5 keeps the lookup column fixed but allows the row to change. C$4 keeps the header row fixed but allows the column to change.
INDEX with two MATCH functions
INDEX returns a value from a range using a row position and a column position. MATCH finds a position. Use exact matching by setting the third argument of each MATCH to 0.
=INDEX(Rates!$C$3:$H$12, MATCH($A5, Rates!$B$3:$B$12, 0), MATCH(C$4, Rates!$C$2:$H$2, 0))The first MATCH finds the row containing the account or instrument. The second MATCH finds the column containing the period. INDEX returns the value where those positions cross.
For example, if $A5 is Revolver and C$4 is 2027, the formula returns 7.1%.
Nested XLOOKUP
If your version of Excel supports XLOOKUP, a nested formula can be clearer:
=XLOOKUP($A5, Rates!$B$3:$B$12, XLOOKUP(C$4, Rates!$C$2:$H$2, Rates!$C$3:$H$12))The inner XLOOKUP selects the column for the period. The outer XLOOKUP selects the row from that column. This approach avoids manually specifying separate row and column positions.
Common errors and controls
The row labels and headers must match exactly. Extra spaces, different date formats, or a header containing text such as 2027A can produce a not-found error. Check that the lookup ranges and return range have compatible dimensions.
A duplicate row label is also risky. Excel may return the first matching row even when the model contains two versions of the same account. Add a duplicate-key check when row labels should be unique:
=COUNTIF(Rates!$B$3:$B$12, $A5)A result other than 1 needs investigation.
Exercise
Which formula returns the rate at the intersection of the row label in A5 and the period in C4?
Show answer
=INDEX(Rates!$C$3:$H$12, MATCH($A5, Rates!$B$3:$B$12, 0), MATCH(C$4, Rates!$C$2:$H$2, 0))