Excel Supreme

Excel track · Exercise 47 of 86 Paid

Two-way INDEX MATCH

Read one cell out of a grid by matching its row and column labels.

Intermediate

Three regions, three quarters

Read-only data · answer in B7

In B7, read the units for the region in B5 and the quarter in B6 from the grid B2:D4.

ABCD
1RegionQ1Q2Q3
2North120140160
3South90110130
4West7595115
5Region?South
6Quarter?Q3
7Units

Download this grid (.xlsx) Two tabs: the grid you see, and the answer.

B7

What it does

Two MATCH calls answer two separate questions. South is second in A2:A4, so the first returns 2. Q3 is third in the header row B1:D1, so the second returns 3. INDEX reads B2:D4 at row 2, column 3, and B7 shows 130.

The two lists run in different directions, which is why they are separate ranges. A2:A4 is a column of regions and B1:D1 is a row of quarters. Give the quarter MATCH the region column and Q3 is not among the labels it searches, so the cell shows #N/A.

Both calls need the zero, since neither list is sorted. A wrong number from either one still produces a figure: swap the two MATCH calls and B7 reads 95, West's Q2. When a two-way answer is a number you did not expect, check each MATCH on its own before blaming INDEX.

Syntax

=INDEX(grid, row, column)

Worked example

On Three regions, three quarters, =INDEX(B2:D4,MATCH(B5,A2:A4,0),MATCH(B6,B1:D1,0)) returns 130.

=INDEX(B2:D4,MATCH(B5,A2:A4,0),MATCH(B6,B1:D1,0))

Common errors

Error codes for Two-way INDEX MATCH
ErrorWhat it means and how to fix it
#N/AA region missing from A2:A4, or a quarter missing from B1:D1, leaves one of the two positions without a value.
Swapped positionsThe two MATCH calls went in the wrong order, so INDEX reads row 3 column 2 and returns 95.
#REF!A MATCH run over a range that reaches past the grid returns a position B2:D4 does not have.

At work

A budget grid with regions down the side and quarters across the top, read by label each month.