← All how-to recipes

How to look up a value by both row and column (two-way lookup)

✓ Verified in LibreOffice 25.8.7.3

Find the cell at the intersection of a matching row label and a matching column label.

The formula

AppFormulaNotes
Excel=INDEX(B2:C3,MATCH("South",A2:A3,0),MATCH("Q2",B1:C1,0))INDEX with two MATCHes: one finds the row, one finds the column.
Google Sheets=INDEX(B2:C3,MATCH("South",A2:A3,0),MATCH("Q2",B1:C1,0))Identical.
LibreOffice Calc=INDEX(B2:C3,MATCH("South",A2:A3,0),MATCH("Q2",B1:C1,0))Identical.

How it works

INDEX(data, row_num, col_num) returns one cell of the data block. The first MATCH finds which row 'South' is in (row 2 of the block), the second finds which column 'Q2' is in (column 2). Their intersection is 40.

Verified, not just documented

We ran =INDEX(B2:C3,MATCH("South",A2:A3,0),MATCH("Q2",B1:C1,0)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 40 — exactly the expected result. Every formula here is confirmed by actually executing it.