How to Fix the #N/A Error

#N/A means a lookup function could not find the value it was asked for. The value is either really missing, or it looks the same but is not identical — extra spaces and numbers stored as text are the usual reasons. Describe your lookup below and get a formula that handles it.

Free, no sign-up required · 5 free generations a day

Last updated

Describe your task, get the formula

Type what you need in plain English, or pick an example below. You get the formula, a step-by-step explanation, and a worked example.

Formulas that fix or replace #N/A

Syntax
=IFNA(VLOOKUP(A2,$D$2:$E$100,2,FALSE),"Not found")
=XLOOKUP(A2,$D$2:$D$100,$E$2:$E$100,"Not found")
=VLOOKUP(TRIM(A2),$D$2:$E$100,2,FALSE)

IFNA replaces only #N/A and leaves other errors visible, which is safer than IFERROR. XLOOKUP has the fallback built in as its fourth argument. TRIM removes leading and trailing spaces from the lookup value, the most common hidden cause of a failed match.

Examples

Show a message instead of #N/A

=IFNA(VLOOKUP(A2,$D$2:$E$100,2,FALSE),"Not found")

Runs the lookup and returns Not found only when the result is #N/A. Other errors, such as #REF!, still show, so real problems are not hidden.

Match a number against numbers stored as text

=VLOOKUP(A2&"",$D$2:$E$100,2,FALSE)

Joining an empty string turns the number in A2 into text so it can match IDs that were imported as text. For the opposite case, wrap the lookup value in VALUE instead.

Check whether the value exists at all

=IF(COUNTIF($D$2:$D$100,A2)>0,"Exists","Missing")

COUNTIF counts exact matches in the lookup column. If it says Missing, the lookup is correct and the value is simply not in the table.

Common mistakes and how to fix them

The value looks identical but still does not match

Compare the two cells directly with =A2=D2. If the result is FALSE, check for trailing spaces with LEN, and for numbers stored as text — they are left-aligned by default.

#N/A appears only after copying the formula down

The table range moved with the formula. Lock it with dollar signs, for example $D$2:$E$100, so every row searches the same table.

VLOOKUP returns #N/A or a wrong row on unsorted data

The fourth argument was left out, so VLOOKUP used approximate match, which needs sorted data. Add FALSE as the fourth argument for an exact match.

Frequently asked questions

What does #N/A mean?

It stands for not available. A lookup function such as VLOOKUP, XLOOKUP, HLOOKUP or MATCH searched for a value and did not find it in the range it was given.

Should I use IFNA or IFERROR?

Use IFNA for lookups. IFERROR hides every error, including #REF! and #NAME?, which usually mean the formula itself is broken and should be fixed, not hidden.

Why does VLOOKUP return #N/A when the value is in the table?

VLOOKUP only searches the first column of the table range. If the value sits in another column, change the range so it starts at that column, or use XLOOKUP or INDEX MATCH.

Does this work in Google Sheets?

Yes. IFNA, VLOOKUP, XLOOKUP, TRIM and COUNTIF work the same way in Google Sheets.

Don't want to write it by hand?

Describe what you need in plain English and get a ready-to-use formula in seconds.

Try the formula generator