← 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 ✓ Verified in Google Sheets (2026-08-30)

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

The formula

AppFormulaNotes
Excel (desktop)=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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 40 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

INDEX · MATCH — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons