Home Guides Excel

Excel

How to Use INDEX and MATCH in Excel: Lookup Formula & Examples

Learn how INDEX and MATCH work together for flexible Excel lookups, including exact matches, left-side lookups, errors and when XLOOKUP may be simpler.

In this guide Step-by-step explanations, practical examples and useful context to help you complete the task confidently.

INDEX and MATCH are two Excel functions that can be combined to build flexible lookup formulas. They are especially useful in existing workbooks where the lookup column is not on the left of the return column or where you want to separate the search logic from the returned value.

Modern Excel users should also know about XLOOKUP, which is often easier to read for new formulas. INDEX/MATCH remains worth understanding because it appears in many established spreadsheets and gives you a clear way to control the lookup and return ranges.

What INDEX and MATCH do

MATCH finds the relative position of a value in a range. INDEX returns a value from a specified position in a range.

=MATCH(lookup_value, lookup_array, 0)
=INDEX(return_range, row_number)

When combined, MATCH finds the row and INDEX returns the value from that row.

The basic INDEX/MATCH formula

=INDEX(B2:B100,MATCH(E2,A2:A100,0))

Read it from the inside out:

  1. MATCH searches for E2 in A2:A100.
  2. The 0 requests an exact match.
  3. MATCH returns the position of the matching row.
  4. INDEX uses that position to return the corresponding value from B2:B100.

Practical example: find a customer's phone number

CustomerPhone
Aria555-0101
Ben555-0102
Chloe555-0103

If names are in A2:A4, phone numbers are in B2:B4, and E2 contains Chloe:

=INDEX(B2:B4,MATCH(E2,A2:A4,0))

The formula returns 555-0103.

Why INDEX/MATCH can solve a VLOOKUP limitation

VLOOKUP traditionally searches the first column of its selected table and returns a value from a column to its right. INDEX/MATCH does not require the return range to be to the right of the lookup range.

For example, if employee IDs are in column C but employee names are in column A, you can search C and return A:

=INDEX(A2:A100,MATCH(E2,C2:C100,0))

This is useful when the worksheet layout cannot easily be changed.

Use exact matching deliberately

For ordinary IDs, names, product codes and similar lookups, use 0 as the MATCH match_type when you want an exact match.

=MATCH(E2,A2:A100,0)

Leaving the match type out changes the behavior because MATCH's default is not the same as an explicit exact match. That is a frequent source of unexpected results in older formulas.

Handle a missing match

If MATCH cannot find the lookup value, the formula can return #N/A. You can use IFERROR to present a friendlier result after verifying that the underlying lookup is correct.

=IFERROR(INDEX(B2:B100,MATCH(E2,A2:A100,0)),"Not found")

Do not use IFERROR as a substitute for checking the source data. Hidden spaces, different data types and misspellings can all cause a legitimate lookup to fail.

Two-way lookup with INDEX and MATCH

When the answer depends on both a row and a column, INDEX can use two MATCH results.

=INDEX(B2:E10,MATCH(H2,A2:A10,0),MATCH(H3,B1:E1,0))

Here the first MATCH finds the row and the second MATCH finds the column. This pattern is useful for tables where a person, product or region selects the row while a month or metric selects the column.

INDEX/MATCH vs XLOOKUP

NeedINDEX/MATCHXLOOKUP
Existing legacy workbookVery commonMay not be available in older versions
Exact lookupUse MATCH with 0Exact match is the modern default
Return to the leftYesYes
Formula readabilityMore nestedUsually simpler

For a new workbook that supports XLOOKUP, it is often the easier starting point. For an existing workbook, replacing a working INDEX/MATCH formula simply because a newer function exists may not be necessary.

Common INDEX/MATCH mistakes

  • Missing exact-match argument: Use MATCH(...,0) when you need an exact match.
  • Different range sizes: The lookup and return ranges should represent the same rows.
  • Hidden spaces: TRIM or CLEAN may be needed when imported text does not match visually.
  • Number vs text mismatch: 123 stored as text is not necessarily the same as numeric 123 for lookup purposes.
  • Duplicate lookup values: MATCH returns the first exact match, so decide whether duplicates are acceptable.
  • Overcomplicated error handling: Fix the data or lookup logic before hiding errors with IFERROR.

A quick troubleshooting method

  1. Run the MATCH portion by itself.
  2. Confirm that it returns the expected row position.
  3. Check that the INDEX return range starts on the corresponding row.
  4. Compare the lookup value and source value for spaces and data type differences.
  5. Only then add IFERROR or additional logic.

If your workbook supports it, compare this approach with Tervilo's XLOOKUP guide. For older lookup workbooks, see VLOOKUP in Excel. Browse the Excel Guides collection for more spreadsheet workflows.

Quick answer

The common pattern is =INDEX(return_range,MATCH(lookup_value,lookup_range,0)). MATCH finds the row position; INDEX returns the value from that position. Use exact matching deliberately and check for data-type or hidden-space problems when a lookup returns #N/A.

You've reached the end

Use the related tools, FAQs and next guides below to continue from the topic you just learned.

Questions & answers

Frequently Asked Questions

Why use INDEX and MATCH together?

MATCH finds the position of a value in a lookup range, while INDEX returns the value from a corresponding return range. The combination is flexible and works well in existing workbooks.

Why does MATCH return #N/A?

The lookup value may not exist, may contain hidden spaces, or may have a different data type from the source. With approximate matching, the sort order can also matter.

Should I use 0 in MATCH?

For ordinary exact lookups such as IDs, names and product codes, MATCH(...,0) explicitly requests an exact match and is usually the clearest choice.

Is XLOOKUP better than INDEX/MATCH?

For new workbooks that support XLOOKUP, it is often simpler to read and maintain. INDEX/MATCH remains useful for existing workbooks and for understanding older spreadsheet logic.

Continue learning

Related Guides

Explore the next practical guide without leaving Tervilo.

Learn more

Related Articles

Understand the wider topic with an informative Tervilo article.