Fix N/A Error in Excel: Causes of #N/A and Quick Fixes

Fix N/A error in Excel: lookup results showing #N/A replaced by Not found and corrected prices

Few things break a report faster than a column full of #N/A. The error simply means a formula could not find the value it was asked to look for, but the reason behind it is not always obvious. This guide shows how to fix N/A error results in Excel step by step, starting with the real causes and only then hiding what is left with IFNA or XLOOKUP. The same fixes work in Google Sheets and LibreOffice Calc.

Every example uses one small price list, and a free practice workbook with the same data is attached to this post.

What the #N/A error means

#N/A stands for “not available”. You will see it most often with XLOOKUP, VLOOKUP, HLOOKUP, LOOKUP, MATCH and XMATCH when the lookup value has no match in the lookup range. Unlike #DIV/0! or #VALUE!, the formula itself is usually written correctly. The data is the problem.

Because #N/A can be a genuine “this item does not exist” answer, avoid wrapping every lookup in an error handler straight away. Find out why the match failed first.

The sample data

The price list sits in A5:C10 with the headers Code, Product and Price. The codes to look up are in E6:E9.

CodeProductPrice
P-101Notebook120
P-102Pen Set85
P-103Stapler240
P-104Desk Lamp1150
P-105Marker Pack160

E6:E9 holds P-102, P-106, “P-103 ” (with a trailing space) and P-105. A plain lookup in F6, copied down, looks like this:

=XLOOKUP(E6,$A$6:$A$10,$C$6:$C$10)

It returns 85, #N/A, #N/A and 160. Two errors, but for two very different reasons.

How to fix N/A error causes one by one

1. The value really is missing

P-106 is not in the price list, so #N/A is the honest answer. Either add the missing item to the source table or show a friendly message (covered below). Do not “fix” this one by changing the formula.

2. Extra spaces in the lookup value

“P-103 ” looks identical to P-103 on screen, yet the trailing space makes it a different text string. Pasted data from web pages and CSV exports is a common source. Clean the value inside the formula with TRIM:

=XLOOKUP(TRIM(E6),$A$6:$A$10,$C$6:$C$10)

Copied down, this returns 85, #N/A, 240 and 160. Only the genuinely missing code is left. If the spaces are in the lookup column instead, clean that column once with a helper column or Find and Replace. Non-breaking spaces from web pages survive TRIM, so use SUBSTITUTE(E6,CHAR(160),””) for those.

3. Numbers stored as text

Excel treats the number 1003 and the text “1003” as different values. In the practice workbook, employee IDs in A17:A20 are real numbers, but the ID typed in D17 is stored as text (note the green triangle in the corner). This returns #N/A:

=VLOOKUP(D17,$A$17:$B$20,2,FALSE)

Convert the lookup value to a number with a double minus (or VALUE) and the formula returns Chen Li:

=VLOOKUP(--D17,$A$17:$B$20,2,FALSE)

For the opposite case, a number looked up in a text column, use TEXT or join an empty string: E6&””. To fix a whole column permanently, select it and use Data > Text to Columns > Finish.

4. Approximate match by accident

If you leave out the last argument of VLOOKUP, Excel uses approximate match (TRUE). On an unsorted list that can return #N/A, or worse, a wrong price with no error at all. Always finish VLOOKUP and HLOOKUP with FALSE, and MATCH with 0, unless you are deliberately looking up bands such as tax brackets. XLOOKUP and XMATCH use exact match by default.

5. The lookup range moved or is too short

Copy a lookup down without $ signs and the range slides with it, so the lower rows search an area that no longer contains the data. Lock the range ($A$6:$A$10) or, better, convert the list to an Excel table so new rows are included automatically.

Show a friendly message with IFNA or XLOOKUP

Once the real causes are fixed, any #N/A left over means the item is genuinely missing. Replace it with readable text using IFNA:

=IFNA(VLOOKUP(TRIM(E6),$A$6:$C$10,3,FALSE),"Not found")

With XLOOKUP you do not need a wrapper at all. The fourth argument, if_not_found, does the same job:

=XLOOKUP(TRIM(E6),$A$6:$A$10,$C$6:$C$10,"Not found")

Both return 85, Not found, 240 and 160. Prefer IFNA over IFERROR for lookups: IFERROR also hides #REF!, #VALUE! and #NAME?, which usually point to a broken formula you need to see. Microsoft’s own guide to correcting a #N/A error lists the same checks. For more on the XLOOKUP arguments, see our XLOOKUP function guide.

Count, list and total around #N/A

Count how many codes in E6:E9 are missing from the price list before you clean them (result: 2):

=SUMPRODUCT(--ISNA(MATCH(E6:E9,$A$6:$A$10,0)))

A single #N/A also breaks SUM, AVERAGE and other totals. To total the original lookup column F6:F9 while skipping the errors (result: 245):

=SUM(IFNA(F6:F9,0))

This works as a normal formula in Excel 365 and 2021 or later. In older versions confirm it with Ctrl+Shift+Enter, and in Google Sheets wrap it in ARRAYFORMULA. =AGGREGATE(9,6,F6:F9) is another Excel option that ignores all errors.

Excel vs Google Sheets vs LibreOffice Calc

TaskExcelGoogle SheetsLibreOffice Calc
Replace #N/A onlyIFNA (2013+)IFNAIFNA
Built-in not-found valueXLOOKUP 4th argument (2021+)XLOOKUP 4th argumentXLOOKUP 4th argument (24.8+)
Test for #N/AISNAISNAISNA
Exact-match VLOOKUPFALSE or 0FALSE (is_sorted)0 (Sorted order)
Remove spacesTRIMTRIM or Data cleanup > Trim whitespaceTRIM

The formulas in this guide can be typed into all three apps unchanged. One difference to watch: Calc may convert text that looks like a number during a lookup, so a mismatch that errors in Excel can appear to work there. Google documents the same function on its IFNA help page.

Quick checklist

  • Does the value really exist in the lookup column?
  • Are there leading, trailing or non-breaking spaces?
  • Are both sides the same type, number or text?
  • Is the match type exact (FALSE, 0 or XLOOKUP)?
  • Is the lookup range locked with $ or stored in a table?
  • Only then: wrap the formula in IFNA or use if_not_found.

FAQ

Should I use IFERROR or IFNA?

Use IFNA for lookups. It handles only #N/A, so real formula mistakes still show up. IFERROR is better for calculations where any error should be replaced, such as division by a blank cell.

Why does #N/A appear even though I can see the value?

Almost always because of hidden spaces or a number stored as text. Test it with =E8=A8 style comparisons, or check the length with LEN.

Can #N/A be useful?

Yes. Excel line charts do not plot #N/A points as zero, so =NA() is a handy way to mark missing data without dragging the line down to the axis. If a dynamic-array formula shows #SPILL! instead, see our guide to fixing the #SPILL! error.

Download the practice workbook

The same data as this tutorial, with empty answer cells and a Solutions sheet.

Team Xl in Excel

Team Xl in Excel

Spreadsheet Architect & Educator at Xl in Excel. Sharing advanced formulas, dynamic arrays, and clean data modeling techniques.

Learn More About Team Xl in Excel →

Leave a Reply

Your email address will not be published. Required fields are marked *

Zoom: 100% | UTF-8 | Xl in Excel