← All Kits · Excel Kit

Two-Way Lookup: Finding a Value by Row and Column at Once

Michael Nocito · Updated August 2026 · Every number on this page was worked before it was published

Regions down the left, months across the top, numbers in the middle. Somebody wants the value for South in March, and they want it to keep working when a region is added.

What you do: INDEX with two MATCHes. It is the version that survives edits to the grid, and it is the one worth committing to muscle memory.

The short version. One MATCH for the row, one for the column, INDEX returns where they cross.

The grid

JanFebMarApr
North10,20010,90011,40010,700
South7,3007,0507,6007,900
East11,80011,20012,00011,650
West5,9006,4006,1006,800

Say the labels are in A2:A5, the months in B1:E1 and the numbers in B2:E5. South and Mar should return 7,600.

The three ways to write it

INDEX with two MATCHes, the one to learn

=INDEX($B$2:$E$5,
        MATCH($G$1, $A$2:$A$5, 0),
        MATCH($G$2, $B$1:$E$1, 0))

G1 holds the region, G2 the month. The first MATCH returns 2 for South, the second returns 3 for Mar, and INDEX returns the value at row 2, column 3 of the grid, which is 7,600. Both zeros mean exact match, and both are essential.

Insert a region or reorder the months and the formula still works, because nothing about the position is written into it.

Nested XLOOKUP, if you have it

=XLOOKUP($G$1, $A$2:$A$5,
         XLOOKUP($G$2, $B$1:$E$1, $B$2:$E$5))

The inner lookup returns the whole March column as an array, and the outer one picks South's row out of it. Shorter to read, and it only runs on Microsoft 365 and Excel 2021 and later. See XLOOKUP is not available before you put it in a shared file.

SUMIFS, when the data is long

=SUMIFS(Data[Amount], Data[Region], $G$1, Data[Month], $G$2)

This is the version to want. It needs the data in a long shape, one row per region and month, and in exchange it handles duplicates by summing them, returns 0 rather than an error for a missing combination, and lets you add a third or fourth condition without changing the shape of the formula.

The honest recommendation. If you own the data, unpivot the grid with Power Query and use SUMIFS. Two-way lookups exist mostly because somebody was handed a grid they were not allowed to change. That is a real situation, which is why the rest of this page exists.

The traps

TrapSymptomFix
Grid range does not align with the header rangesOff-by-one values, no errorGrid rows must match the label range exactly
Missing the 0 in MATCHWrong value, silentlyType the 0 every time
Ranges not lockedErrors appearing lower downF4 on every range, or use table names
Merged header cellsMATCH finds nothingUnmerge. Merged cells break most functions.
Duplicate row labelsSilently returns the firstUse SUMIFS, which adds them up
Header stored as text, key as a date#N/A on every columnMake both the same type

The last one bites on month headers constantly. A header typed as Mar is text, and a cell holding a real date formatted as Mar is a number. They look identical and never match. Test with =ISTEXT(B1).

Making it a real interface

  1. Put the two keys in labelled cells at the top, not inside the formula.
  2. Give both cells a data validation list drawn from the headers, so a typo becomes impossible. See data validation.
  3. Add a not-found message: =IFERROR(the formula, "no such combination"), once you know why it would fail.
  4. Colour the two input cells differently from everything else. Inputs and outputs looking the same is how a reported number gets typed over.

How to apply this to your own work

  1. Find the grids in your workbooks and ask which ones you are allowed to reshape. Reshape those.
  2. For the rest, replace any hard-coded column numbers with MATCH, and note how many formulas that immunises against an inserted column.
  3. Check every header row for merged cells and for text-against-date mismatches.
  4. Move lookup keys into labelled input cells with validation lists.
  5. Where duplicates are possible, use SUMIFS rather than a lookup, so two matching rows produce a sum instead of a silent first-match.

The one habit to keep

Ask whether the grid is a shape for reading or a shape for storing. Grids are excellent to look at and poor to compute from, and most two-way lookup problems are really a storage shape that should have been long.

How many of your formulas contain a column number typed by hand?

Every number here was worked before it was published. South and Mar is row 2, column 3 of the grid, which is 7,600.
A grid is a shape for reading, not a shape for calculating from.

Excel for Analysts is 378 pages that read every formula and dialog one at a time, so the workbook stops being a place where numbers appear and becomes one you can check.

Excel for Analysts, $19 →
The better answer is usually to unpivot the grid.

Power Query turns a grid into a long table in two clicks, after which a normal SUMIFS does the job. INDEX MATCH covers the one-way version.

Read Power Query →