Excel INDEX MATCH: Step-by-Step Guide
In this article
INDEX MATCH is a two-function combination that looks up a value in one column and returns a matching value from another column, even when the lookup column is not the first column of your data. It is more flexible than VLOOKUP because it can look left as well as right. To use it, you need a lookup value, a lookup range, a return range, and a basic understanding of how Excel references work. The formula pattern is =INDEX(return_range, MATCH(lookup_value, lookup_range, 0)). This guide walks you through building it correctly, avoiding common errors, and fixing it when it returns the wrong result.
What You'll Need
- Excel 2016 or later, Microsoft 365, or Excel for Mac (the functions work in all modern versions).
- A table of data with at least two columns: one to search in (the lookup column) and one to return a value from (the return column).
- The exact value you want to find, or a cell reference containing it.
- Basic familiarity with cell references (e.g., A2:A100) and absolute references (the $ sign).
Step-by-Step
- Set up your data. Place your lookup values in one column and the values you want to return in another. For example, put product IDs in column A and product names in column B. Ensure there are no blank rows in the middle of the ranges you will use.
- Decide the lookup value. This is the value you want to find. It can be a typed value like "P100" or a cell reference like E2. For flexibility, use a cell reference so you can change the lookup value without editing the formula.
- Identify the lookup range. This is the column (or row) where Excel will search for the lookup value. In the example, that is A2:A100. Use absolute references (e.g., $A$2:$A$100) so the range does not shift when you copy the formula down.
- Identify the return range. This is the column (or row) that contains the value you want to bring back. In the example, that is B2:B100. Again, use absolute references.
- Write the MATCH function. MATCH finds the position of the lookup value within the lookup range. The syntax is
MATCH(lookup_value, lookup_range, 0). The 0 means exact match. For example:MATCH(E2, $A$2:$A$100, 0). This returns a number representing the row position within the range (1 for the first row, 2 for the second, etc.). - Wrap it in INDEX. INDEX takes a range and a position number and returns the value at that position. The syntax is
INDEX(return_range, position_number). Combine with MATCH:=INDEX($B$2:$B$100, MATCH(E2, $A$2:$A$100, 0)). This tells Excel: find the position of E2 in A2:A100, then return the value from B2:B100 at that same position. - Press Enter and test. Type a known lookup value in E2 and confirm the formula returns the correct result. If it returns #N/A, the lookup value was not found. If it returns #REF!, the ranges are invalid.
- Copy the formula down or across. Because you used absolute references for the ranges, you can copy the formula to other cells. If you want to change the lookup value per row, use a relative reference for the lookup value (e.g., E2 becomes E3 when copied down).
- Optional: use structured references with Excel Tables. If your data is in an Excel Table (created with Ctrl+T or Insert > Table), you can use table names instead of cell ranges. For example: . This automatically expands as you add rows.
Common Mistakes
- Forgetting the 0 in MATCH. Without the 0, MATCH defaults to approximate match, which requires sorted data and often returns wrong results. Always include 0 for exact match.
- Using relative references for ranges. If you copy the formula without absolute references (e.g., A2:A100 instead of $A$2:$A$100), the ranges shift and return incorrect values or errors.
- Mismatched range sizes. The lookup range and return range must have the same number of rows (or columns). If they differ, INDEX may return a value from the wrong row or #REF!.
- Looking up numbers stored as text. If the lookup value is a number but the lookup column contains text (or vice versa), MATCH will fail. Use VALUE() or TEXT() to convert, or ensure consistent formatting.
- Including header rows in ranges. If your range includes the header, the position numbers will be off by one. Start ranges at the first data row.
- Extra spaces. Trailing spaces in either the lookup value or the lookup column cause #N/A. Use TRIM() to clean data.
Tips
- Use named ranges or Excel Tables to make formulas easier to read and maintain.
- Combine with IFERROR to display a friendly message instead of #N/A:
=IFERROR(INDEX(...), "Not found"). - For two-way lookups (matching both row and column headers), use INDEX with two MATCH functions:
=INDEX(data_range, MATCH(row_value, row_headers, 0), MATCH(column_value, column_headers, 0)). - If you need to return multiple columns, you can copy the formula across and adjust the return range column, or use INDEX with a column number argument.
- Use F4 to quickly toggle absolute references when editing the formula.
- Test with a lookup value you know exists and one you know does not, to verify error handling.
Troubleshooting
If the formula returns #N/A, the lookup value was not found in the lookup range. Check for typos, extra spaces, or data type mismatches (text vs. number). Use the Evaluate Formula tool (Formulas > Evaluate Formula) to step through the calculation. If it returns #REF!, the return range is invalid or the position number is out of bounds. Verify that both ranges have the same size. If it returns the wrong value, check that the lookup range and return range are aligned (same starting row and same number of rows). Also ensure the 0 is present in MATCH. If the formula works for some rows but not others, check for merged cells or hidden rows that might affect references. For large datasets, consider using XLOOKUP if available, as it is simpler and more robust, but INDEX MATCH remains compatible with older versions.
Frequently Asked Questions
Can INDEX MATCH look to the left?
Yes. Unlike VLOOKUP, INDEX MATCH can return a value from a column to the left of the lookup column. Just set the return range to the left column and the lookup range to the right column.
Is INDEX MATCH case-sensitive?
No, by default MATCH is not case-sensitive. For case-sensitive lookups, use the EXACT function inside an array formula, but that is more advanced.
What is the difference between INDEX MATCH and XLOOKUP?
XLOOKUP is newer and combines the functionality into one function, but it is only available in Excel 365 and Excel 2021. INDEX MATCH works in all versions and is still widely used.
Can I use INDEX MATCH with wildcards?
Yes, if the lookup value contains wildcards (* or ?), MATCH will interpret them. For example, "P*" will match any text starting with P. This only works for text values.
Why does my INDEX MATCH return 0?
This usually means the return cell is empty or contains 0. Check the return range and ensure it points to the correct column. Also verify that the MATCH position is correct.
Can I use INDEX MATCH across multiple sheets?
Yes. Reference the ranges with sheet names, e.g., =INDEX(Sheet2!$B$2:$B$100, MATCH(E2, Sheet2!$A$2:$A$100, 0)). Make sure the sheet names are spelled correctly and include apostrophes if the name contains spaces.