Learn › Article
How to Use INDEX and MATCH Together in Excel
To use INDEX and MATCH together, put MATCH inside INDEX: =INDEX(return_range, MATCH(lookup_value, lookup_range, 0)). MATCH finds the position of your lookup value in one column, and INDEX returns the value at that same position in another column. It works in every version of Excel.
What INDEX and MATCH each do
The two functions are simple on their own. The power comes from joining them.
INDEX(range, row_num)returns the value at a given row number inside a range.MATCH(lookup_value, lookup_range, 0)returns the position of the lookup value inside a range. The final0means exact match.
So MATCH answers "which row?" and INDEX answers "what is in that row?"
Set up the practice data
Type this into a new sheet, starting in cell A1:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ID | Name | Department | Salary |
| 2 | 101 | Maya | Sales | 52000 |
| 3 | 102 | Omar | Marketing | 48000 |
| 4 | 103 | Lena | Sales | 55000 |
| 5 | 104 | Jonas | IT | 61000 |
| 6 | 105 | Priya | IT | 59000 |
The goal: find the salary for ID 104.
Build the formula step by step
- Find the position of 104 in the ID column. Type
=MATCH(104,A2:A6,0). The result is 4, because 104 is the fourth item in A2:A6. - Use that position with INDEX. Type
=INDEX(D2:D6,4). The result is 61000, the fourth value in D2:D6. - Replace the typed 4 with the MATCH formula:
=INDEX(D2:D6,MATCH(104,A2:A6,0)). The result is 61000.
Now make it reusable. Type 104 in cell F1, then use =INDEX($D$2:$D$6,MATCH(F1,$A$2:$A$6,0)). Change F1 to 102 and the answer becomes 48000. The dollar signs lock the ranges so they stay put if you copy the formula down.
Look up to the left
VLOOKUP can only return values from columns to the right of the lookup column. INDEX and MATCH have no such limit, because the two ranges are separate. To find the ID for Priya:
=INDEX(A2:A6,MATCH("Priya",B2:B6,0))
The result is 105. The ID column is to the left of the Name column, and the formula still works.
Do a two-way lookup
INDEX can take a column number as well as a row number: INDEX(range, row_num, column_num). You can use a second MATCH to find the column from a heading. To get the Salary for ID 103:
=INDEX(A2:D6,MATCH(103,A2:A6,0),MATCH("Salary",A1:D1,0))
- The first MATCH returns 3, because 103 is the third ID.
- The second MATCH returns 4, because "Salary" is the fourth heading in A1:D1.
- INDEX returns the value in row 3, column 4 of A2:D6, which is 55000.
Change "Salary" to "Department" and the result becomes Sales.
Why use this instead of VLOOKUP?
- It can look left as well as right.
- It does not break if someone inserts a column, because it points at real ranges rather than a column number such as
3. - It handles two-way lookups neatly.
If you want to compare, see How to Use VLOOKUP in Excel: Worked Example. In Excel 2021 and Microsoft 365 there is also a newer function that does the same job in one step, covered in How to Use XLOOKUP Instead of VLOOKUP in Excel.
Common problems and fixes
| Problem | Likely cause | Fix |
|---|---|---|
#N/A | MATCH found no exact match | Check spelling, extra spaces, and whether the value exists |
| Wrong value returned | Last argument of MATCH left out or set to 1 | Use 0 for an exact match |
| Wrong row returned | Ranges start on different rows | Make both ranges cover the same rows, such as 2 to 6 |
#N/A on numbers | One side is text, the other is a real number | Convert both to the same type |
To show a friendly message instead of an error, wrap the formula in IFERROR:
=IFERROR(INDEX(D2:D6,MATCH(999,A2:A6,0)),"Not found")
The result is Not found, because there is no ID 999.
Stuck on the whole assignment?
Lookup formulas are usually only one part of a bigger task with several sheets and steps. Excelerant builds the real Excel workbook for a whole assignment from the instructions and the starter file, and explains every step so you can follow the logic. If you would like to see how it works on yours, upload your assignment to Excelerant.
Frequently asked questions
Can MATCH look up text as well as numbers?
Yes. Put the text in quotation marks, such as =MATCH("Priya",B2:B6,0), or point to a cell that contains it. MATCH is not case-sensitive, so "priya" finds "Priya".
What does the 0 in MATCH mean?
It means exact match. Without it, MATCH defaults to 1, which finds the largest value that is less than or equal to your lookup value and needs the data sorted in ascending order.
Do I need to press Ctrl+Shift+Enter?
No. The formulas in this article are ordinary formulas and work with a normal Enter in every version of Excel.