Fixing Excel XLOOKUP Returning #N/A When Match Mode Is Wrong

May 29, 2026 1 min read 23 views
A clean spreadsheet grid with a red error cell transforming into a resolved green checkmark against a soft blue background

Your XLOOKUP formula looks correct. The value you're searching for is sitting right there in the column. Yet Excel stubbornly returns #N/A. Before you rewrite the whole formula, check the fifth argument β€” match_mode β€” because that single parameter is responsible for a large share of XLOOKUP failures that are otherwise invisible.

What you'll learn

  • How the four match_mode values actually behave and when each one fails silently
  • The specific scenarios that cause #N/A for each mode
  • How to diagnose which mode is wrong for your data
  • Practical fixes including wildcard matches, approximate matches, and IFERROR wraps
  • Common pitfalls that look like match mode problems but aren't

A quick refresher on XLOOKUP syntax

The full signature is:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

The fifth argument, match_mode, accepts four numeric values. Most tutorials only cover the default, which is why the others catch people off guard.

ValueModeWhat it does
0Exact matchDefault. Returns #N/A if no exact match is found.
-1Exact or next smallerFalls back to the largest value less than or equal to the lookup value.
1Exact or next largerFalls back to the smallest value greater than or equal to the lookup value.
2WildcardTreats *, ?, and ~ as pattern characters.

When you omit the argument entirely, Excel uses 0. That default is correct most of the time, but it will silently fail the moment your data doesn't match exactly β€” including differences in whitespace, case sensitivity nuances, or number formatting.

Scenario 1: Exact match failing because of invisible differences

The most common reason match_mode = 0 returns #N/A has nothing to do with the mode itself β€” the lookup value and the table value look identical but aren't. Here's how to check.

Trailing spaces

Copy the cell value into a formula like =LEN(A2) and compare it to what you expect. If

πŸ“€ Share this article

Sign in to save

Comments (0)

No comments yet. Be the first!

Leave a Comment

Sign in to comment with your profile.

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.