The #N/A error
It is the lookup error: VLOOKUP, XLOOKUP, MATCH or INDEX did not find the value requested. Nine times out of ten, the value is there, just written slightly differently.
What it means
#N/A means "not available". A lookup function went through the range without finding the value, and says so rather than returning a wrong result.
It is the most useful of the errors: it points to a real gap in the data. Hiding it without understanding it throws that information away.
Where it comes from
- Extra spaces: "Smith" and "Smith " (with a trailing space) are not the same value. Software exports are full of them, non-breaking spaces included.
- A number stored as text on one side: code 1024 is a number in one file and text in the other (small green triangle). For Excel, they differ.
- The lookup range slid: the formula was copied down without
$, andB2:E50becameB40:E88. The first values are no longer in the range. - The value really is missing: a new customer, a mistyped code.
- An approximate match on an unsorted list: VLOOKUP without a fourth argument looks for an approximate value and can return #N/A (or worse, a wrong result).
- The NA() function, written on purpose, often so that a chart skips a point.
Fixing it
- End VLOOKUP with
,FALSEfor an exact lookup:=VLOOKUP(A2,Customers!$A:$C,3,FALSE). - Clean both compared columns:
=TRIM(A2), or Clean text on the whole file. - Give both sides the same type: Convert text to numbers, or
=VALUE(A2)in the formula. - Lock the lookup range with
$before copying:$B$2:$E$50. - Check that the value exists:
=COUNTIF(Customers!A:A,A2)returns 0 if it is missing.
Hiding it, when it is expected
When absence is normal (a product with no discount, a customer with no order), =IFNA(VLOOKUP(…),"") shows an empty cell. IFNA only hides #N/A; IFERROR would also hide a typo or a broken range.
With XLOOKUP, the fourth argument says what to return: =XLOOKUP(A2,Customers!A:A,Customers!C:C,"Unknown").
Tools that help
- Look up between two files: VLOOKUP between two files, with no formula, which neutralises spaces, case and numbers stored as text, and lists the keys not found.
- Explain a formula: flags the approximate match and the sliding range.
- Find the right formula: the lookup written for you, locked ranges included.
Frequently asked questions
- Why does VLOOKUP return #N/A when the value exists?
- Almost always because of an invisible difference: an extra space, a number stored as text on one side only, or a lookup range that slid when copied because it lacked
$. - Should I use IFERROR or IFNA?
- IFNA around a lookup: it only hides "not found". IFERROR hides every error, including those that point to a broken formula.