INDEX MATCH Not Working? 7 Causes and Fixes
By ExcelReady TeamUpdated 6 min read
The short answer
INDEX MATCH usually fails because MATCH is missing its 0 for an exact match, the INDEX and MATCH ranges don't start on the same row, or the lookup value and the data don't match exactly (text vs numbers, extra spaces). Write it as =INDEX(C2:C7,MATCH(E2,A2:A7,0)), with both ranges the same size, and lock them with $ before copying.
Key takeaways
- Always end MATCH with 0 for an exact match; without it, MATCH guesses on unsorted data.
- The INDEX range and the MATCH range must start and end on the same rows.
- MATCH needs a single row or column, not a whole table.
- The number 1004 and the text "1004" don't match; neither do "Ben" and "Ben ".
- Lock both ranges with $ signs before you fill the formula down.
On this page+
- How INDEX MATCH works (and where it breaks)
- Cause 1: MATCH is missing the 0
- Cause 2: the ranges don't line up
- Cause 3: MATCH looks in more than one column
- Cause 4: numbers stored as text
- Cause 5: hidden spaces
- Cause 6: the ranges move when you copy the formula
- Cause 7: INDEX gets the whole table without a column number
- Practise it
When INDEX MATCH is not working, you usually see #N/A or, worse, a wrong answer with no error. The cause is almost always one of seven small things: a missing 0, ranges that don't line up, a 2D range in MATCH, text versus numbers, hidden spaces, unlocked ranges, or INDEX pointing at the whole table. This guide shows how to spot and fix each one.
How INDEX MATCH works (and where it breaks)#
INDEX MATCH is two functions working together. MATCH finds the position of a value in a list. INDEX returns the value at that position from another list.
=INDEX(return_range, MATCH(lookup_value, lookup_range, 0))All the examples use this staff list in A1:C7:
| A | B | C | |
|---|---|---|---|
| 1 | ID | Name | Dept |
| 2 | 1001 | Ana | Sales |
| 3 | 1002 | Ben | IT |
| 4 | 1003 | Chloe | HR |
| 5 | 1004 | Dev | IT |
| 6 | 1005 | Ema | Finance |
| 7 | 1006 | Farid | Sales |
=INDEX(C2:C7,MATCH(1004,A2:A7,0)) returns IT. MATCH finds 1004 in position 4 of A2:A7, and INDEX returns the 4th value of C2:C7. To test a broken formula, check MATCH on its own first: type =MATCH(1004,A2:A7,0) in a spare cell. If that fails, the problem is in MATCH. If it works, the problem is in INDEX. The INDEX MATCH guide covers the basics.
Cause 1: MATCH is missing the 0#
MATCH's third argument is the match type, and if you leave it out, it defaults to 1, an approximate match. Approximate match assumes the list is sorted and returns the nearest smaller value when there's no exact match.
=INDEX(C2:C7,MATCH(1007,A2:A7))There's no employee 1007, but this returns Sales, Farid's department, because 1006 is the largest ID below 1007. Add the 0 and you get #N/A, which correctly tells you the ID doesn't exist:
=INDEX(C2:C7,MATCH(1007,A2:A7,0))On unsorted data, approximate match can return a value from a random-looking row. The MATCH function guide explains the three match types.
Cause 2: the ranges don't line up#
INDEX counts positions from the top of its own range, so both ranges must start on the same row. If they don't, every result is shifted.
=INDEX(C3:C8,MATCH(1004,A2:A7,0))MATCH still returns 4, but the 4th cell of C3:C8 is C6, so the result is Finance instead of IT. No error, just the wrong row. If the INDEX range is shorter than the position MATCH returns, you get #REF! instead.
Check that both ranges cover exactly the same rows, such as A2:A7 and C2:C7.
Cause 3: MATCH looks in more than one column#
MATCH only works on a single row or a single column. If you give it a whole table, it returns #N/A:
=MATCH(1004,A2:C7,0)Point MATCH at the one column that holds the lookup values, here A2:A7. For a two-way lookup (row and column), use two MATCH functions inside INDEX: one for the row and one for the column.
Cause 4: numbers stored as text#
The number 1004 and the text "1004" look identical, but MATCH treats them as different values. This happens when IDs are imported from another system, or when the lookup cell is formatted as Text. Text numbers usually sit on the left of the cell.
The best fix is to convert the data to real numbers: select the column, click the warning icon and choose Convert to Number. If you can't change the data, convert the lookup value inside the formula instead:
- Data is text, lookup value is a number:
MATCH(E2&"",A2:A7,0)turns E2 into text. - Data is numbers, lookup value is text:
MATCH(VALUE(E2),A2:A7,0)turns E2 into a number.
Cause 5: hidden spaces#
A trailing space makes "Ben " different from "Ben", so MATCH can't find it. Test a cell with =LEN(B3): "Ben" should return 3.
Clean the data with TRIM in a helper column, then paste the results back as values. Or trim the lookup value in the formula: MATCH(TRIM(E2),B2:B7,0). That only fixes spaces in the lookup value, not in the data, so cleaning the column is the better long-term fix.
If TRIM doesn't help, the space may be a non-breaking space, a special character often copied from web pages. TRIM can't remove it. Use SUBSTITUTE to replace it first: =TRIM(SUBSTITUTE(B3,CHAR(160)," ")). CHAR(160) is the code for the non-breaking space. After cleaning, the LEN check should return the length you expect.
Cause 6: the ranges move when you copy the formula#
If you fill INDEX MATCH down a column, unlocked ranges slide down with it. In the next row, A2:A7 becomes A3:A8 and the first record is no longer searched, so some lookups return #N/A.
Lock both ranges with $ signs and leave the lookup cell unlocked:
=INDEX($C$2:$C$7,MATCH(E2,$A$2:$A$7,0))Select each range in the formula and press F4 to add the $ signs (Mac: ⌘T).
Cause 7: INDEX gets the whole table without a column number#
If the INDEX range has several columns, INDEX needs a column number too. =INDEX(A2:C7,MATCH(1004,A2:A7,0)) has no column number. In Microsoft 365, it spills the whole row (1004, Dev, IT) across three cells, and shows #SPILL! if those cells aren't empty. Older versions may show #VALUE! or an unexpected value.
Either give INDEX a single column, as in all the examples above, or add the column number: =INDEX(A2:C7,MATCH(1004,A2:A7,0),3) returns IT. The INDEX function guide explains the row and column arguments.
If you have Microsoft 365 or Excel 2021, XLOOKUP avoids several of these traps, because it defaults to an exact match and needs no position numbers. See INDEX MATCH vs XLOOKUP for a side-by-side comparison, and XLOOKUP not working if you switch and hit new errors.
Practise it#
Practise INDEX MATCH in a live spreadsheet: you'll build lookups that go left and right, and the sheet checks each formula as soon as you press Enter. Then fix broken formulas in the lookup errors lesson, which covers #N/A, wrong rows and text numbers. Try the exercise on this page first.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Find the department for the employee ID in E2. Click F2 and type an INDEX MATCH that returns from C2:C7, matches in A2:A7, and uses 0 for an exact match. Press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Dept | Dept | |||||
| 2 | Sales | ||||||
| 3 | IT | ||||||
| 4 | HR | ||||||
| 5 | IT | ||||||
| 6 | Finance | ||||||
| 7 | Sales | ||||||
| 8 | |||||||
| 9 | |||||||
| 10 |
Tip: INDEX(what to return, MATCH(what to find, where to look, 0)).
Practise this in a lesson
Frequently asked questions
Why is my INDEX MATCH returning #N/A?
MATCH couldn't find the lookup value. Check that the value really exists, that it's the same type (number or text) as the data, and that there are no extra spaces. Also make sure MATCH ends with 0.
Why does INDEX MATCH return the wrong value?
Usually the INDEX range and the MATCH range start on different rows, or MATCH is missing its 0 and is doing an approximate match. Line up the ranges and add 0 as the third argument of MATCH.
Why does INDEX MATCH work in one cell but not when copied?
The ranges weren't locked, so they shifted down as you copied. Use absolute references like $A$2:$A$7 and $C$2:$C$7.
Can INDEX MATCH look to the left?
Yes. The return range can be any column, left or right of the lookup column. That is one of its main advantages over VLOOKUP.