Function Problems

How to Use INDEX and MATCH for Two-Way Lookup in Excel

Natalie TaylorNatalie Taylor Nov 10, 2026 869 views

Question details

The user needs to create an Excel formula using INDEX and MATCH to retrieve a value from a two-dimensional table based on multiple criteria.

How to Use INDEX and MATCH for a Two-Way Lookup Table
Product
Excel
Device & OS
not provided
Scenario
Calculating the required number of overnight stays from a calculator table by cross-referencing input values for working hours and a specific zone.
Observed behavior
The intended formula dynamically identifies the correct row and column headers and accurately outputs the intersecting numerical value.
Before you start

Verify that your lookup table is formatted with clear, unique row and column headers, and locate the specific cells containing the input criteria you want to match.

Solution 1Recommended

Use standard INDEX and MATCH for a two-way lookup

Combine one INDEX function with two MATCH functions to locate and return the exact intersection of a row and a column.

The MATCH function finds the relative position of your row and column criteria within headers.

The INDEX function then retrieves the value at that specific visual coordinate within your data array.

1
Identify your data ranges

Locate your lookup table range (e.g., H2:L1000), your row headers (e.g., G2:G1000), and column headers (e.g., H1:L1).

2
Select the result cell

Click on the cell where you want the resulting calculation (the number of stays) to be displayed.

3
Enter the formula

Type the formula: =INDEX(H2:L1000, MATCH(B4, G2:G1000, 0), MATCH(B5, H1:L1, 0)). Replace B4 with your hours input cell and B5 with your zone input cell.

4
Calculate the result

Press Enter to execute the formula and return the value.

Use standard INDEX and MATCH for a two-way lookup
Exact Match Parameter: Using '0' as the third argument in your MATCH formulas forces the function to look for an exact match, preventing incorrect shifting data approximations.
WPS Spreadsheet Solution

Easily Construct Complex Formulas with WPS Spreadsheet

WPS Spreadsheet fully supports robust lookup formulas like INDEX and MATCH, empowering you to build dynamic calculators effortlessly. You get a familiar formula interface with excellent compatibility.

  1. 1. Open your workbook: Launch WPS Office and open your .xlsx file in WPS Spreadsheet.
  2. 2. Select the destination cell: Click the cell designated for your calculation result.
  3. 3. Insert the function: Navigate to the Formulas tab, select Insert Function, and search for INDEX, or directly type your =INDEX(...) formula into the formula bar.
  4. 4. Press Enter: Hit Enter to instantly cross-reference your table and retrieve the accurate value.
100% compatible with Microsoft Excel formulas and .xlsx filesIntelligent formula builder with clear syntax highlightingLightweight, lag-free performance even when calculating large data tablesCompletely free to download and use on Windows, Mac, and mobile
QA img-9

Frequently Asked Questions

What does the 0 mean in the MATCH function?

The 0 instructs the MATCH function to find an exact match for the lookup value. If an exact match does not exist in the specified range, it returns an #N/A error.

Why is my INDEX MATCH formula returning a #REF! error?

A #REF! error usually occurs if your MATCH function returns a row or column number that sits outside the defined boundaries of your INDEX array. Always check that your header ranges perfectly align with the dimensions of your data body.

Can I use XLOOKUP instead of INDEX and MATCH for this?

Yes. In modern spreadsheet software updates, you can nest one XLOOKUP function inside another to perform a two-way lookup, which often results in simpler, more readable syntax compared to INDEX and MATCH.