Tabellab
Excel formulas

#N/A error in Excel: why it appears and how to fix it

The #N/A error in Excel means "not available": a lookup such as VLOOKUP, XLOOKUP or MATCH did not find the value it was looking for. It has three common causes. The lookup value differs invisibly (a stray space), it has a different data type (a number stored as text), or it really is missing from the table. In the example, three of six orders return #N/A. TRIM repairs two of them, and IFNA labels the one product that really is not in the price list, so 5 of 6 orders get a price and the sixth says "Not listed".

Updated 21 Oct 2026 6 min read By Tabellab team

What #N/A means

Excel returns #N/A when a function needs a value that is not available. In practice it comes from lookups almost every time: =VLOOKUP(B3,$A$10:$B$14,2,FALSE) searches the first column of the price list for the code in B3, and if no cell matches exactly, the result is #N/A. XLOOKUP, MATCH, HLOOKUP and LOOKUP behave the same way.

The error spreads. Any formula that uses an #N/A cell, such as an order total or a SUM of the column, becomes #N/A as well. That is why one missing code can break a whole report, and why it is worth finding the cause instead of hiding every error.

Worked example: an order sheet with three #N/A lookups

Rows 2 to 7 are orders, rows 10 to 14 the price list. Column C shows the length of each code, column D whether a plain exact-match lookup would find it, and column E the repaired lookup with TRIM and IFNA. The company is fictional.

Worked example: an order sheet with three #N/A lookups
ABCDE
1OrderProduct codeLENPlain lookup finds it?Repaired price lookup
2SO-1201SN-755Yes12.40
3SO-1202SN-76 6No: #N/A14.90
4SO-1203 CH-126No: #N/A8.75
5SO-1204LP-2006No: #N/ANot listed
6SO-1205bx-305Yes21.50
7SO-1206CH-145Yes9.60
8
9Price list codeUnit price
10SN-7512.40
11SN-7614.90
12CH-128.75
13CH-149.60
14BX-3021.50
15
16Orders whose plain lookup returns #N/A3
17Orders still "Not listed" after the repair1
18Orders priced after the repair (COUNT skips text)5
Key formulas
  • C3=LEN(B3)6 characters: a stray space
  • D3=IF(ISNA(MATCH(B3,$A$10:$A$14,0)),"No: #N/A","Yes")Would a plain lookup fail?
  • E3=IFNA(VLOOKUP(TRIM(B3),$A$10:$B$14,2,FALSE),"Not listed")Clean the value, label what is truly missing
  • E16=COUNTIF(D2:D7,"No*")Failed plain lookups

All codes and prices are fictional. Text cells keep their spaces, so B3 and B4 hold "SN-76 " and " CH-12".

Cause 1: spaces and other invisible characters

"SN-76 " with a trailing space is not the same text as "SN-76". You cannot see the difference, but LEN can: in the example, the codes in B3 and B4 have 6 characters instead of 5. Clean the lookup value inside the formula:

=VLOOKUP(TRIM(B3),$A$10:$B$14,2,FALSE)

TRIM removes leading and trailing spaces and reduces double spaces to one. Text pasted from a web page can also contain a non-breaking space, CHAR(160), which TRIM leaves alone. SUBSTITUTE(B3,CHAR(160),"") removes it. If the spaces sit in the lookup table instead, clean the table once rather than every formula. For more text clean-up patterns see extracting text between two characters.

Cause 2: numbers stored as text

A customer ID imported as the text "40121" never matches the number 40121 in the customer list, even though both look identical. Signs of text numbers are a small green triangle in the cell, left alignment, and =ISTEXT(H2) returning TRUE for an ID in H2.

Convert the lookup value inside the formula: =VLOOKUP(--H2,…) or =VLOOKUP(VALUE(H2),…). The double minus turns text that looks like a number into a number. In the opposite case, text IDs in the table and numbers in the lookup cell, join an empty string: H2&"". Case does not matter: "bx-30" finds "BX-30", as row 6 of the example shows.

Cause 3: the value really is missing

Sometimes #N/A is correct. Product LP-200 is not in the price list, so no formula can find its price. That is a business fact to report, not a bug to hide. Show it with a clear label:

=IFNA(VLOOKUP(TRIM(B5),$A$10:$B$14,2,FALSE),"Not listed")

Then count the open cases with =COUNTIF(E2:E7,"Not listed"), so someone adds the product or fixes the order. Avoid returning 0 instead of a label: a price of 0 looks like a real value and quietly lowers every total and average that uses it.

IFNA or IFERROR?

IFNA catches only #N/A. IFERROR catches every error: #N/A, but also #REF! from a deleted column, #NAME? from a typo in a function name and #VALUE! from text in arithmetic. Wrapping a lookup in IFERROR therefore hides real bugs behind the friendly label. Use IFNA for lookups, so a broken formula still shows up.

XLOOKUP has the label built in: =XLOOKUP(TRIM(B2),$A$10:$A$14,$B$10:$B$14,"Not listed"). Its fourth argument is returned only when nothing is found. The differences between the two lookups are covered in XLOOKUP vs VLOOKUP.

Other reasons for #N/A

  • Approximate match by accident. VLOOKUP without its fourth argument uses approximate match, which needs a sorted first column. On unsorted data it returns wrong prices or #N/A. Always write FALSE (or 0) for exact matches.
  • A range that does not move. A lookup table written as A10:B14 without dollar signs shifts when the formula is copied down, and the lower rows search too small a range. Lock it with $A$10:$B$14.
  • Lookup value outside the first column. VLOOKUP only searches the leftmost column of the range. Use XLOOKUP or INDEX/MATCH to look to the left, see INDEX MATCH with multiple criteria.
  • The #N/A comes from the source. Some models use NA() on purpose to mark missing data, for example so that a chart skips a point.

Find and count #N/A in a sheet

=ISNA(D3) returns TRUE for an #N/A cell, and =SUMPRODUCT(--ISNA(D2:D7)) counts them in a range. To jump to every error at once, use Go To Special › Formulas › Errors. Before an import or a month-end report, a small check cell such as =IF(SUMPRODUCT(--ISNA(D2:D7))=0,"OK","CHECK") makes sure no lookup failed silently.

Common mistakes

  • Hiding every error with IFERROR. It also hides #REF! and #NAME?, so a broken formula looks fine. Use IFNA for lookups.
  • Returning 0 for a missing value. A 0 price or a 0 rate is a number and distorts totals and averages. Return a text label and count the labels.
  • Forgetting the last VLOOKUP argument. Without FALSE, VLOOKUP does an approximate match on unsorted data and returns wrong results or #N/A.
  • Cleaning the wrong side. TRIM around the lookup value does not help if the spaces sit in the lookup table. Check LEN on both sides.
  • Unlocked lookup ranges. A table reference without $ moves when the formula is copied, and lower rows return #N/A. Lock it with absolute references.
  • Assuming a match is case-sensitive. VLOOKUP and MATCH ignore case, so "bx-30" finds "BX-30". If case matters, use EXACT inside an INDEX/MATCH.

Frequently asked questions

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

Usually because the two values only look the same: one has a leading or trailing space, or one is a number and the other a number stored as text. Compare them with LEN and ISTEXT, then use TRIM or -- (or VALUE) inside the lookup.

How do I replace #N/A with a blank or text in Excel?

Wrap the lookup in IFNA: =IFNA(VLOOKUP(A2,Table,2,FALSE),"Not listed"). Use "" for a blank cell. With XLOOKUP, put the text in the fourth argument, if_not_found.

What is the difference between IFNA and IFERROR?

IFNA only catches the #N/A error. IFERROR catches all errors, including #REF!, #NAME? and #VALUE!, which usually point to a broken formula. For lookups, IFNA is the safer choice.

How do I count #N/A errors in a range?

Use =SUMPRODUCT(--ISNA(A2:A100)). To count every type of error, use ISERROR instead of ISNA. Go To Special › Formulas › Errors selects them all.

Practise it in a lab

Related guides

Reading is step one. Doing is step two.

Every guide links to a lab where you build the same calculation in an online spreadsheet and get instant feedback.

Open the lab