ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Lookups
  3. Two-Way Lookup in Excel (Row and Column)

Two-Way Lookup in Excel (Row and Column)

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

A two-way lookup finds the value where a row and a column meet, like units sold for one product in one month. Use INDEX with two MATCHes: =INDEX(B2:E6,MATCH(H1,A2:A6,0),MATCH(H2,B1:E1,0)). The first MATCH finds the row, the second finds the column, and INDEX returns the cell where they cross.

Key takeaways

  • A two-way lookup matches a row label and a column header at the same time.
  • INDEX(table, MATCH for the row, MATCH for the column) works in every version of Excel.
  • The row MATCH range must line up with the table's rows, and the column MATCH range with its columns.
  • Mixed references like $G10 and H$9 let one formula fill a whole report grid.
  • In Excel 2021 or Microsoft 365, a nested XLOOKUP also does a two-way lookup.
On this page+
  1. What is a two-way lookup?
  2. Two way lookup Excel formula with INDEX and MATCH
  3. The one rule: line up the ranges
  4. Build a report grid with one formula
  5. Use drop-down lists for the row and column
  6. Other ways to do a two-way lookup
  7. Why does a two-way lookup return an error?
  8. Practise it

A two-way lookup returns the value where a row and a column meet: the units sold of one product in one month, or the price of one item in one size. The classic two way lookup Excel formula is INDEX with two MATCHes, one for the row and one for the column, and it works in every version of Excel. This guide is for anyone who knows a basic lookup and now has a grid of data with labels on two sides.

What is a two-way lookup?#

A normal lookup uses one key, like a product code, and returns a value from a fixed column. A two-way lookup uses two keys: one picks the row, the other picks the column. Here is a table of units sold:

ABCDE
1ProductJanFebMarApr
2Linen Notebook A512095140110
3Desk Planner 2027210804530
4Washi Tape Set607590130
5Brass Paper Clips40553550
6Fineliner Set706585100

You want the cell where the Fineliner Set row crosses the Feb column. The answer is 65, but you want a formula that finds it, so it updates when someone changes the product in H1 or the month in H2.

Two way lookup Excel formula with INDEX and MATCH#

INDEX can take a row number and a column number: =INDEX(table, row_num, column_num). Give it a MATCH for each:

Excel formula
=INDEX(B2:E6,MATCH(H1,A2:A6,0),MATCH(H2,B1:E1,0))

Read it in three parts:

  1. B2:E6 is the block of numbers only, without the labels.
  2. MATCH(H1,A2:A6,0) finds the product's row. Fineliner Set is the 5th product, so it returns 5.
  3. MATCH(H2,B1:E1,0) finds the month's column. MATCH works across a row just as it does down a column. Feb is the 2nd month, so it returns 2.

INDEX then returns row 5, column 2 of B2:E6, which is 65. Change H2 to Apr and the result becomes 100. If you are new to these functions, read the INDEX function guide and the MATCH function guide first.

The one rule: line up the ranges#

The row MATCH must cover the same rows as the table, and the column MATCH the same columns. This is where most two-way lookups go wrong.

RangeMust matchIn this example
Row labels for the first MATCHThe table's rowsA2:A6 for rows 2 to 6
Column headers for the second MATCHThe table's columnsB1:E1 for columns B to E
INDEX tableNumbers onlyB2:E6

If you write MATCH(H2,A1:E1,0), the header range starts in column A, so Feb returns 3 instead of 2. INDEX then gives you March's number, 85, with no error. The order of the MATCHes matters too: row first, then column. Swap them and you get the wrong cell, or #REF! if the number is too big for the table.

Build a report grid with one formula#

You can fill a whole summary table from one formula by using mixed references: a $ on the column of the row labels and a $ on the row of the headers. Say your report has products in G10:G12 and months in H9:I9:

GHI
9JanApr
10Desk Planner 202721030
11Linen Notebook A5120110
12Brass Paper Clips4050

Type this in H10:

Excel formula
=INDEX($B$2:$E$6,MATCH($G10,$A$2:$A$6,0),MATCH(H$9,$B$1:$E$1,0))
  • $G10 always reads column G but moves down the rows.
  • H$9 always reads row 9 but moves across the columns.
  • Every range that points at the data table is fully locked.

Fill it down with Ctrl+D (Mac: ⌘D) and across with Ctrl+R (Mac: ⌘R). Each cell finds its own product and month. This is a common task in Excel tests, and it appears in our list of practice tasks to try before an Excel test.

Use drop-down lists for the row and column#

A two-way lookup is often the engine of a small "pick a product, pick a month" report. Drop-down lists make it easy to use, and they stop typos that cause #N/A:

  1. Select H1, the product cell.
  2. Go to Data > Data Validation.
  3. Under Allow, choose List. In Source, type =$A$2:$A$6, then click OK.
  4. Do the same for H2, with =$B$1:$E$1 as the source.

Now H1 and H2 show an arrow, and you can only pick a product and month that exist in the table. Change either one and the INDEX MATCH result updates straight away. This is a small touch that makes a report feel finished in a job test.

Other ways to do a two-way lookup#

INDEX MATCH is the most flexible option, but there are two others you may see.

VLOOKUP with MATCH for the column#

Replace VLOOKUP's typed column number with a MATCH:

Excel formula
=VLOOKUP(H1,A1:E6,MATCH(H2,A1:E1,0),FALSE)

Here the header range must start in column A, the same column as the table, because VLOOKUP counts columns from the table's first column. Feb returns 3, and column 3 of A1:E6 is Feb. This works in every version, but it can only look to the right.

A nested XLOOKUP#

In Excel 2021 or Microsoft 365, you can put one XLOOKUP inside another:

Excel formula
=XLOOKUP(H1,A2:A6,XLOOKUP(H2,B1:E1,B2:E6))

The inner XLOOKUP finds Feb in the headers and returns the whole Feb column (C2:C6). The outer XLOOKUP finds Fineliner Set in the products and returns its value from that column: 65. Learn the rest of XLOOKUP in our XLOOKUP beginner's guide. Like INDEX MATCH, XLOOKUP can also look up to the left.

Why does a two-way lookup return an error?#

Each error has a likely cause:

  • #N/A: one MATCH didn't find its value. Check the spelling of the product and the month, and look for extra spaces or numbers stored as text. Our guide on fixing #N/A errors covers each cause.
  • #REF!: a position is bigger than the table, often because the two MATCHes are swapped.
  • A wrong number with no error: a MATCH range doesn't line up with the table, or a MATCH is missing its 0.

Practise it#

Two-way lookups feel tricky until you have built one with your own hands. ExcelReady's INDEX/MATCH skill check gives you a stock report with monthly units: you run a two-way lookup for one product and month, then fill a small report grid from a single formula with mixed references, all in a live spreadsheet. Try the size-and-price exercise on this page, then take the INDEX/MATCH skill check.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Click H3 and return the price of the item in H1 in the size in H2. Use INDEX on the prices B2:D4, with one MATCH on the items in A2:A4 and one on the sizes in B1:D1.

fx
ABCDEFGHI
1
Item
S
M
L
Item
Hoodie
2
T-shirt
12
12
14
Size
L
3
Hoodie
30
32
34
Price
4
Jacket
55
58
62
5
6
7

Tip: Row first: MATCH the item in A2:A4. Column second: MATCH the size in B1:D1. Both with 0.

Practise this in a lesson

LessonINDEX/MATCH skill checkTest your INDEX and MATCH on a stock report: look up to the left, find the best-stocked item, and run two-way lookups across a monthly table.Function guideINDEXLearn the Excel INDEX function: return a value by row and column position, build two-way lookups with MATCH, and practice live.Function guideMATCHLearn how Excel's MATCH finds the position of a value, why the 0 matters, and how it powers INDEX/MATCH. Includes a live exercise.

Frequently asked questions

What is a two-way lookup in Excel?

+

It is a lookup that uses two keys at once, one to pick the row and one to pick the column, and returns the value where they cross. A typical example is sales for a given product in a given month.

Can VLOOKUP do a two-way lookup?

+

Yes, if you replace its column number with a MATCH: =VLOOKUP(H1,A1:E6,MATCH(H2,A1:E1,0),FALSE). The MATCH range must start in the same column as the table.

How do I do a two-way lookup with XLOOKUP?

+

Nest one XLOOKUP inside another: =XLOOKUP(H1,A2:A6,XLOOKUP(H2,B1:E1,B2:E6)). The inner XLOOKUP returns the whole month column, and the outer one picks the product from it. This needs Excel 2021 or Microsoft 365.

Why does my two-way lookup return the wrong value?

+

Usually a MATCH range doesn't line up with the INDEX table, for example a header range that starts in column A while the table starts in column B. Make each MATCH range cover exactly the rows or columns of the table.

Why does my two-way lookup return #N/A?

+

One of the two MATCHes couldn't find its value. Check the spelling of the row label and the column header, and look for extra spaces.

Sources

  • INDEX function - Microsoft Support
  • MATCH function - Microsoft Support
  • XLOOKUP function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What is a two-way lookup?
  2. Two way lookup Excel formula with INDEX and MATCH
  3. The one rule: line up the ranges
  4. Build a report grid with one formula
  5. Use drop-down lists for the row and column
  6. Other ways to do a two-way lookup
  7. Why does a two-way lookup return an error?
  8. Practise it

Keep reading

Lookups· 7 min read

XLOOKUP in Excel: Everything a Beginner Needs

XLOOKUP finds a value in one range and returns the matching item from another: =XLOOKUP(G2,B2:B9,A2:A9). It defaults to an exact match, can return a column on either side, and has a built-in if_not_found message instead of #N/A. It needs Excel 2021, Excel 2024 or Microsoft 365; it isn't in Excel 2019 or earlier.

Lookups· 6 min read

How to Fix #N/A Errors in VLOOKUP and XLOOKUP

#N/A means "not available": the lookup couldn't find your value. First find the cause: extra spaces (fix with TRIM), numbers stored as text, a typo, or a table range that moved because it wasn't locked with $. If the item is truly missing, show a message with IFNA, or with XLOOKUP's 4th argument.

Lookups· 6 min read

How to Look Up to the Left in Excel

VLOOKUP can't look to the left: it searches the first column of its table and only returns columns to the right. To return a column on the left, use INDEX MATCH, =INDEX(A2:A9,MATCH(G2,B2:B9,0)), which works in every version, or XLOOKUP, =XLOOKUP(G2,B2:B9,A2:A9), in Excel 2021 or Microsoft 365.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free