Spreadsheet & Formula Studio

Fix #N/A in Excel VLOOKUP: Causes and Fixes

Why VLOOKUP returns #N/A when the value seems to be there: approximate match, spaces, text numbers, and when to use IFNA instead of IFERROR.

PerkTonic Team4 min read
Cover of the guide "Fix #N/A in Excel VLOOKUP: Causes and Fixes"

VLOOKUP returns #N/A and the value is clearly in the table. Excel is not wrong: it found no match under the rules your formula applies. The usual suspects are an approximate match used by mistake, extra spaces, and numbers stored as text. Start with the Excel Formula Debugger, which lists the likely causes for your formula.

Why the lookup fails

#N/A means "not available": the lookup value was not found. Four situations account for most cases where the value looks present:

  • The fourth argument is missing, so VLOOKUP runs an approximate match. In that mode the first column must be sorted ascending, and a value that sorts before the first entry gives #N/A.
  • The lookup cell or the table cell contains extra spaces, for example a trailing space after a product code.
  • One side holds a number and the other holds the same digits stored as text.
  • The lookup value is not in the first column of the table range. VLOOKUP only searches the leftmost column.

Each of these has a different fix, so identify the cause before you change the formula.

Steps with the debugger

  1. Open the Excel Formula Debugger.
  2. Paste the formula, for example =VLOOKUP(A2,Prices!A:C,3).
  3. Pick #N/A as the error.
  4. Read the Likely causes.
Excel Formula Debugger listing likely causes for a VLOOKUP #N/A error, with the approximate-match cause marked
With no fourth argument, the debugger lists the approximate-match cause for this VLOOKUP.

The rules cover approximate-match lookups, numbers stored as text and extra spaces. For this formula the approximate-match cause applies, because the formula has no fourth argument. Causes that depend on your data, such as text numbers and trailing spaces, are marked medium or low confidence. The debugger cannot see your cells, so treat those two as things to check, not as findings.

To narrow it down, use Ask the AI. Describe your data in a short text, up to 2,000 characters: what the lookup value looks like, where the table comes from and what the first column contains. The fix it returns lists its assumptions, so compare them with your sheet before you apply anything.

Ask the AI result in the Excel Formula Debugger with the assumptions list marked
The fix lists its assumptions, which you compare with your own data before applying it.

The AI part is limited to 10 requests per 10 minutes. The rule-based causes keep working without the AI, so you can still read the Likely causes after the limit is reached.

Extra spaces and numbers stored as text

These two causes come from the data, not from the formula, so test them in the cells.

Extra spaces: in a spare cell enter =LEN(A2) and compare it with the length you expect. If the value is longer, wrap the lookup value in TRIM: =VLOOKUP(TRIM(A2),Prices!A:C,3,FALSE). If the spaces are in the table, clean that column once instead of trimming in every formula.

Numbers stored as text: =ISNUMBER(A2) returns FALSE for a text number, and the cell is usually left-aligned or shows a green triangle. Convert the lookup value with =VLOOKUP(VALUE(A2),Prices!A:C,3,FALSE), or convert the table column so both sides have the same type.

If the data comes from an export and many rows have these problems, clean the file before the lookup. Clean Messy CSV Data is the tool for that step. When the sheet shows #VALUE! instead of #N/A, read Fix #VALUE! in Excel When the Cells Look Fine.

Approximate match by mistake

When the fourth argument is left out, VLOOKUP uses TRUE, which means approximate match. The formula =VLOOKUP(A2,Prices!A:C,3) can therefore return #N/A, or worse, a wrong row without any error, when the first column is not sorted. For exact lookups, state the match type:

=VLOOKUP(A2,Prices!A:C,3,FALSE)

Use FALSE (or 0) whenever you look up codes, names or IDs. Approximate match is meant for ranges such as tax bands or grade thresholds, where the sorted table is deliberate.

If the lookup column is not the first column of the table, VLOOKUP cannot reach it. Convert the formula with the XLOOKUP vs INDEX-MATCH Generator, which turns a VLOOKUP, including one wrapped in IFERROR, into an XLOOKUP.

XLOOKUP vs INDEX-MATCH Generator showing an IFERROR VLOOKUP converted to an XLOOKUP formula
The same lookup rewritten as XLOOKUP, which searches any column and defaults to an exact match.

For a comparison of both replacements, see XLOOKUP vs INDEX/MATCH: Which One to Use. A different error from the same function is covered in Fix #REF! in Excel VLOOKUP: Causes and Fixes.

IFERROR or IFNA: hiding versus fixing

IFERROR(value, value_if_error) replaces every error with the result you choose, including #REF!, #VALUE! and #NAME?. That hides real mistakes in the formula. IFNA(value, value_if_na) replaces only #N/A, so other errors still show.

=IFNA(VLOOKUP(A2,Prices!A:C,3,FALSE),"Not found")

Use IFNA when "not in the table" is an expected result, such as a new product that has no price yet. Do not use either function to cover a lookup that should find the value. Fix the cause first, then add IFNA only for the legitimate misses. Microsoft documents the function on its support page IFNA function. Microsoft's general guide is How to correct a #N/A error.

Check your own file

Open the Excel Formula Debugger, paste the VLOOKUP that returns #N/A and pick #N/A. Read the Likely causes, check the data-dependent ones in your cells with LEN and ISNUMBER, and add FALSE as the fourth argument if the match should be exact.

Was this guide helpful?
Share

Comments