Two-way lookups
Regions run down the side and months across the top. For East in May, the answer is where that row and column cross.
keyboard Typing formulas is easiest on a computer with a keyboard.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Jan | Feb | Mar | Apr | May | Jun | ||
| 2 | North | 1580 | 200 | 1360 | 2360 | 2340 | 820 | |
| 3 | South | 1550 | 1790 | 1140 | 2390 | 1200 | 1280 | |
| 4 | East | 500 | 1090 | 740 | 540 | 1280 | 340 | |
| 5 | West | 1070 | 1890 | 830 | 620 | 290 | 1140 | |
| 6 | Central | 1500 | 1960 | 850 | 650 | 1650 | 1400 | |
| 7 | ||||||||
| 8 | Region | Month | Sales | |||||
| 9 | East | May | ||||||
| 10 | East | Mar | ||||||
| 11 | Central | Jun | ||||||
| 12 | Central | Jun | ||||||
| 13 | North | Jan | ||||||
| 14 | ||||||||
| 15 | ||||||||
| 16 | ||||||||
| 17 |
How INDEX and MATCH and XLOOKUP works
What is a two-way lookup?
Finding the value where a row and a column cross: the sales for South in March, or the price for a size and a colour. You look up two things at once, one down the side and one across the top.
How does
INDEXdo it?INDEXcan take a row number and a column number:=INDEX($B$2:$G$6,3,2)gives the cell 3 rows down and 2 across. Find each number withMATCH:=INDEX($B$2:$G$6,MATCH(A9, $A$2:$A$6, 0), MATCH(B9, $B$1:$G$1, 0)) - The first
MATCHfinds the region's row in the labels down the side. - The second finds the month's column in the labels across the top.
- The first
What has to line up?
The labels down the side must cover the same rows as the
INDEXrange, and the labels across the top the same columns. HereA2:A6matches rows 2 to 6 andB1:G1matches columns B to G.Is there an
XLOOKUPway?Yes, one
XLOOKUPinside another. The inner one returns the region's whole row; the outer one picks the month from it:=XLOOKUP(B9,$B$1:$G$1, XLOOKUP(A9, $A$2:$A$6, $B$2:$G$6))
Know someone fighting with a spreadsheet? Send them this page.