โ† Back to Error Directory

INDEX/MATCH Returning #N/A? Here's How to Debug It

Two functions working together means two places to look for the bug โ€” here's how to isolate exactly which one is failing.

Table of Contents

1. Why INDEX/MATCH Fails Differently Than VLOOKUP

INDEX/MATCH is really two independent functions working together: MATCH() finds the numeric position of your lookup value within a range, and INDEX() then returns whatever sits at that position in a separate range. This split design is exactly why INDEX/MATCH is more flexible than VLOOKUP (it can look in any direction, and doesn't break when columns are inserted), but it also means a #N/A error could theoretically come from either half โ€” though in practice, it's almost always MATCH.

2. Interactive Demo: Isolate the Failing Half

This simulates testing MATCH independently, exactly as you'd do in a real spreadsheet to isolate the bug.


Warehouse-A, Warehouse-C, Warehouse-D

3. When MATCH Is the Real Problem (Almost Always)

Because MATCH is doing the actual "finding" work, every cause of a standard lookup failure applies here identically: hidden spaces, non-breaking spaces, text-vs-number mismatches, and genuinely absent values. Test MATCH in isolation first, every time, before assuming the problem is more complex than it actually is:

=MATCH(A2, B2:B100, 0)

If this returns a number, INDEX will work correctly once you wrap it back in. If this returns #N/A, fix the lookup value/range mismatch using the same techniques covered in our VLOOKUP hidden characters guide โ€” the underlying cause is identical.

4. The Match Type Argument Explained

MATCH's third argument is frequently misunderstood or accidentally omitted:

Match typeBehaviorData requirement
0Exact match onlyNone โ€” works on unsorted data
1 (or omitted)Largest value โ‰ค lookup valueData must be sorted ascending
-1Smallest value โ‰ฅ lookup valueData must be sorted descending

If you omit the third argument entirely, MATCH defaults to 1 (approximate match), not 0 โ€” this is a frequent source of confusion, since leaving it out silently changes the function's fundamental behavior rather than throwing an obvious warning. Always specify 0 explicitly unless you specifically need approximate matching against sorted data.

5. Row vs Column Orientation Mismatches

A subtler cause: your MATCH range is a column (e.g., B2:B100) but your INDEX return range is a row (e.g., C1:Z1), or vice versa. INDEX and MATCH don't automatically detect this mismatch โ€” the formula won't reliably return the correct value, and depending on the specific mismatch, may return #N/A, #REF!, or simply the wrong answer without any error at all. Always confirm both ranges share the same orientation and length before troubleshooting further.

6. The Rare Cases Where INDEX Itself Fails

Although uncommon, INDEX can independently contribute to a #N/A situation in a couple of scenarios worth knowing:

7. Two-Way INDEX/MATCH Lookups

A common intermediate technique combines two MATCH functions โ€” one for the row position and one for the column position โ€” inside a single INDEX:

=INDEX(DataTable, MATCH(RowValue,RowHeaders,0), MATCH(ColValue,ColumnHeaders,0))

When this fails, test each MATCH independently in separate helper cells rather than guessing โ€” with two MATCH calls nested together, there are now two independent places the #N/A could be coming from, and isolating each one individually is dramatically faster than staring at the combined formula.

8. INDEX/MATCH vs VLOOKUP vs XLOOKUP

If you're troubleshooting INDEX/MATCH regularly due to its two-part complexity, it's worth knowing that XLOOKUP was specifically designed to replace this pattern with a single, simpler function that includes built-in error handling via if_not_found โ€” see our XLOOKUP guide for a direct comparison. INDEX/MATCH remains valuable primarily for its universal compatibility with older Excel versions that don't yet support XLOOKUP.

9. Frequently Asked Questions

Why does INDEX/MATCH return #N/A?

In an INDEX/MATCH combination, the #N/A almost always originates from the MATCH function failing to find the lookup value, not from INDEX itself. Test the MATCH portion alone in a separate cell to confirm whether it returns a valid position number or #N/A on its own.

How do I test just the MATCH part of an INDEX/MATCH formula?

Copy only the MATCH portion of your formula into an empty cell by itself, such as =MATCH(A2,B2:B100,0), and check whether it returns a number or #N/A. If MATCH alone fails, the problem is in your lookup value or lookup range, not in the INDEX function.

What does the third argument of MATCH actually do?

The third argument controls match type: 0 requires an exact match, 1 finds the largest value less than or equal to the lookup value in an ascending sorted list, and -1 finds the smallest value greater than or equal to the lookup value in a descending sorted list. Using the wrong match type against unsorted data is a common cause of unexpected #N/A errors.

Related Guides

Editorial Disclaimer: This guide is developed to the best of our domain knowledge and tested against Excel 2019+, Microsoft 365, and Google Sheets. Content is updated continuously as spreadsheet calculation engines evolve.