AnalystPracticeGuides
DashboardSign up

Two-way lookup in Excel: find a value by row and column

A two-way lookup finds the value where a row label and a column header meet, such as sales for one product in one month. Use INDEX with two MATCH functions, or a nested XLOOKUP in newer Excel.

Watch it solved. Task 9: row and column lookup (INDEX MATCH), from 6:20, in our video “Excel Interview Questions and Answers: 10 Practical Tasks, Solved”. Pressing play loads the video from YouTube (privacy). Open on YouTube

How does INDEX with two MATCHes work?

Products are in A2:A6, months in B1:M1, sales in B2:M6. The product you want is in P1 and the month in P2:

=INDEX(B2:M6,MATCH(P1,A2:A6,0),MATCH(P2,B1:M1,0))

The first MATCH finds the row, the second finds the column, and INDEX returns the value where they cross.

How do you do it with XLOOKUP?

=XLOOKUP(P1,A2:A6,XLOOKUP(P2,B1:M1,B2:M6))

The inner XLOOKUP returns the whole month column, and the outer one picks the product from it.

Common mistakes

The header range and the data range must line up: the months in B1:M1 belong to the columns B:M of the data. A label with an extra space never matches, so clean labels with TRIM first.

Where is this used?

Price lists by size and region, budget versus actual by month, and in interviews, where it is a standard follow-up after a simple VLOOKUP.

Try it yourself. Practise this in a real spreadsheet in your browser, with instant feedback.
Practise two-way lookups Practise INDEX MATCH

Updated November 2026.

← All free guides