LAMBDA · Lookup

Two-way lookup LAMBDA

xl.two.way returns the cell where a row label and a column label meet. Dallas in 2026 is 22 on the sample grid.

Microsoft 365, Excel 2024, and Excel for the web. Excel 2021 does not have LAMBDA.

Syntax =xl.two.way(row_label, col_label, row_headers, col_headers, data)

xl.two.way
=LAMBDA(row_label, col_label, row_headers, col_headers, data,
  LET(
    row_num, XMATCH(row_label, row_headers),
    col_num, XMATCH(col_label, col_headers),
    INDEX(data, row_num, col_num)
  )
)

Arguments

NameRequiredWhat to pass
row_labelRequiredThe label to find down the row headers.
col_labelRequiredThe label to find across the column headers.
row_headersRequiredA one-column list aligned with the rows of data.
col_headersRequiredA one-row list aligned with the columns of data.
dataRequiredThe value block, without the headers.

Examples

Dallas sales in 2026

=xl.two.way("Dallas", 2026, A2:A3, B1:C1, B2:C3)

Result 22

=INDEX(B2:C3,XMATCH(E2,A2:A3),XMATCH(E3,B1:C1))E4
Sales
ABCDE
120252026Label
2Austin1012CityDallas
3Dallas2022Year2026
4Value22
A picture of the sheet, not a live calculator. E1 is the column label 2026.

xl.two.way is the intersection lookup. INDEX and XMATCH do it in one line that is easy to get backwards. The row headers are Austin and Dallas. The column headers are 2025 and 2026. Dallas and 2026 meet at 22.

The labels are exact. dallas matches Dallas because XMATCH is not case-sensitive. A year stored as text does not match a numeric header.

Add it to the workbook

Copy the formula in the block above, including the line breaks. Choose Formulas, Name Manager, New. Set the name to xl.two.way, the scope to Workbook, and paste into Refers to. Excel Labs can do the same step: open the Advanced Formula Environment, add that name, and save it back to the workbook. A cell then calls =xl.two.way(...).

The name needs Microsoft 365, Excel 2024, or Excel for the web. Excel 2021 returns #NAME? for LAMBDA even when it already has XLOOKUP, FILTER, or LET.

How it works

XMATCH returns the position of the row label inside the row headers, and the position of the column label inside the column headers. INDEX uses those two positions on the data block only. The headers are not inside data. If you include the header row in the data, every position is off by one.

Limits

The first match wins if a label is repeated. The function does not total a group. GROUP.SUM does that. A missing label is #N/A, which IFNA can replace.