Excel errors

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

Why VLOOKUP, XLOOKUP and MATCH return #N/A: missing values, extra spaces, text-numbers, sliding ranges, approximate match. Every cause with its fix.

#N/A is Excel's way of saying "not available": a formula went looking for something and came back empty-handed. Nine times out of ten the formula is a lookup such as VLOOKUP, XLOOKUP, MATCH, HLOOKUP or LOOKUP, and the value you asked for is not in the list, or it is there but Excel does not see it as the same value. Unlike most other errors, #N/A is not a sign of a broken formula. It is an answer: "I searched and found nothing". Your job is to decide whether that answer is true (the item really is missing) or false (the item is there, but spaces, number formats or a sliding range hide it). This page walks through every common cause with a small sheet that reproduces it, shows the fix, and explains when you should leave the error visible on purpose. For the overview of all error values see Formula errors: what each one means and how to fix it.

What #N/A means

A cell shows #N/A when a function cannot produce a value for the input it was given. Lookup functions return it when there is no match, array calculations return it for positions that do not exist, and some statistical functions such as MODE.SNGL return it when there is no answer (no value repeats). You can also type it on purpose with NA: =NA() returns #N/A. Like every error, #N/A propagates: any formula that uses a #N/A cell returns #N/A too, so one missing product code can turn an invoice total, a dashboard figure and a chart into #N/A at once.

Cause 1: the value really is not in the lookup list

The simplest case. Below, the price list contains P-101 to P-103 and someone asks for P-104. VLOOKUP with FALSE (exact match) searches the first column of A2:C4, does not find P-104 and returns #N/A.

F2fx=VLOOKUP(E2, A2:C4, 3, FALSE)
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-104#N/A
3P-102Mouse12
4P-103Monitor189

P-104 is not in the price list, so the exact-match lookup fails.

Result: #N/A

Fix. First confirm the item really is missing (search the list with Ctrl+F). If it is, decide what the sheet should show and say so explicitly. In Microsoft 365 and Excel 2021 or later, XLOOKUP has a built-in if_not_found argument:

F2fx=XLOOKUP(E2, A2:A4, C2:C4, "Not in list")
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-104Not in list
3P-102Mouse12
4P-103Monitor189

XLOOKUP's fourth argument replaces #N/A with your own message.

Result: Not in list

In older versions wrap the lookup in IFNA (Excel 2013 and later): =IFNA(VLOOKUP(E2, A2:C4, 3, FALSE), "Not in list"). IFNA reacts only to #N/A, so a different problem, such as a deleted column that produces #REF!, still shows up instead of being silently replaced.

Cause 2: extra spaces or invisible characters

This is the most common reason for a "false" #N/A. The code looks identical on screen, but one side has a trailing space, a leading space or a non-breaking space copied from a web page or an accounting system. To Excel, "P-102 " and "P-102" are different texts.

F2fx=XLOOKUP(E2, A2:A4, C2:C4)
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-102 #N/A
3P-102Mouse12
4P-103Monitor189

E2 contains P-102 followed by a space. =LEN(E2) returns 6 instead of 5, which gives the space away.

Result: #N/A

Fix. Clean the lookup value with TRIM, which removes leading and trailing spaces and squeezes double spaces inside the text:

F2fx=XLOOKUP(TRIM(E2), A2:A4, C2:C4)
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-102 12
3P-102Mouse12
4P-103Monitor189

TRIM removes the trailing space, so the codes now match.

Result: 12

If the spaces are in the table instead, clean the column once (a helper column with =TRIM(A2), then Paste Special › Values over the original), or in Microsoft 365 trim inside the formula: =XLOOKUP(TRIM(E2), TRIM(A2:A4), C2:C4). TRIM does not remove the non-breaking space (character 160) that web pages use; for that add SUBSTITUTE: =TRIM(SUBSTITUTE(E2, CHAR(160), " ")). CLEAN removes line breaks and other non-printing characters. The Text cleanup: TRIM, CLEAN, TEXTSPLIT, Flash Fill and Text to Columns lesson covers these tools in depth.

Cause 3: a number on one side, text on the other

Employee numbers, postcodes and invoice numbers often arrive from other systems as text that looks like a number. A lookup never treats the number 1002 and the text "1002" as equal, so you get #N/A even though you can see the match. Clues: text-numbers are left-aligned by default, often carry a green triangle (Green triangle in Excel cells: what it means and how to fix it), and =ISTEXT(A3) returns TRUE.

E2fx=VLOOKUP(D2, A2:B4, 2, FALSE)
ABCDE
1Emp IDNameFind IDName
21001Maria1002#N/A
31002Tom
41003Priya

The IDs in column A were imported as text; D2 holds the real number 1002.

Result: #N/A

Fix. Make both sides the same type. The quick formula fix converts the lookup value to text by joining an empty string to it:

E2fx=VLOOKUP(D2&"", A2:B4, 2, FALSE)
ABCDE
1Emp IDNameFind IDName
21001Maria1002Tom
31002Tom
41003Priya

D2&"" turns the number 1002 into the text "1002", which matches column A.

Result: Tom

In the opposite situation (real numbers in the table, a text lookup value) convert with --D2 or VALUE: =VLOOKUP(--D2, A2:B4, 2, FALSE). The permanent fix is to convert the column itself: select it, click the warning icon and choose Convert to Number, or use Data › Text to Columns › Finish.

Cause 4: the lookup range slid when the formula was copied

You write a perfect VLOOKUP in F2 and fill it down. Because A2:C4 is a relative reference, the copy in F3 looks in A3:C5, the one in F4 in A4:C6, and so on. The first rows of the table drop out of the search and items that are clearly in the list return #N/A.

F3fx=VLOOKUP(E3, A3:C5, 3, FALSE)
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-10212
3P-102Mouse12P-101#N/A
4P-103Monitor189

F2 worked, but the copy in F3 searches A3:C5, which no longer contains P-101.

Result: #N/A

Fix. Lock the table with absolute references before copying: =VLOOKUP(E2, $A$2:$C$4, 3, FALSE) (press F4 after typing the range to add the dollar signs). Even better, turn the list into an Excel table (Ctrl+T) and use structured references such as Prices[Code], which never slide. See Cell references: relative, absolute and mixed for how $ works.

F3fx=VLOOKUP(E3, $A$2:$C$4, 3, FALSE)
ABCDEF
1CodeProductPriceFindPrice
2P-101Keyboard25P-10212
3P-102Mouse12P-10125
4P-103Monitor189

With $A$2:$C$4 every copy searches the whole table.

Result: 25

Cause 5: approximate match and a value below the first row

With approximate match (TRUE, or the fourth argument left out) VLOOKUP finds the largest value that is less than or equal to the lookup value. If the lookup value is smaller than the very first entry, there is nothing to fall back to and the result is #N/A. The same happens when the first column is not sorted in ascending order: the search can stop in the wrong place and return #N/A or, worse, a wrong value.

E2fx=VLOOKUP(D2, A2:B4, 2, TRUE)
ABCDE
1Weight from (kg)ShippingParcel kgCost
2150.5#N/A
359.5
41014

The table starts at 1 kg, so a 0.5 kg parcel has no band.

Result: #N/A

Fix. Make the first band start at the lowest possible value (usually 0) and keep the first column sorted from smallest to largest:

E2fx=VLOOKUP(D2, A2:B4, 2, TRUE)
ABCDE
1Weight from (kg)ShippingParcel kgCost
2050.55
359.5
41014

With a 0 kg band every positive weight finds a rate.

Result: 5

XLOOKUP is safer here because it does not need sorted data: =XLOOKUP(D2, A2:A4, B2:B4, , -1) finds the exact match or the next smaller item, wherever it sits in the list.

Cause 6: VLOOKUP is searching the wrong column

VLOOKUP always searches the first column of the table you give it and can only return columns to its right. If you want the code of a product name, and the code is in the first column, VLOOKUP looks for the name among the codes and fails.

F2fx=VLOOKUP(E2, A2:C4, 1, FALSE)
ABCDEF
1CodeProductPriceFindCode
2P-101Keyboard25Mouse#N/A
3P-102Mouse12
4P-103Monitor189

"Mouse" is searched for in column A, which contains only codes.

Result: #N/A

Fix. Use a lookup that lets you choose the search column and the return column separately: XLOOKUP, or INDEX with MATCH in any version.

F2fx=XLOOKUP(E2, B2:B4, A2:A4)
ABCDEF
1CodeProductPriceFindCode
2P-101Keyboard25MouseP-102
3P-102Mouse12
4P-103Monitor189

Search the Product column, return the Code column. =INDEX(A2:A4, MATCH(E2, B2:B4, 0)) gives the same result in older versions.

Result: P-102

Cause 7: arrays of different sizes

In Microsoft 365, when a formula combines two ranges of different sizes, Excel pads the shorter one and returns #N/A in the positions that have no partner. A typo in one range address is enough.

D2fx=B2:B4*C2:C3
ABCD
1ItemQtyPrice
2Pens3412
3Paper51050
4Ink26#N/A

B2:B4 has three cells, C2:C3 only two, so the third row has nothing to multiply.

Fix. Make the ranges the same size: =B2:B4*C2:C4 returns 12, 50 and 12. If you see #N/A only at the bottom of a spilled result, a mismatched range is the first thing to check.

Cause 8: #N/A coming from the source data

Sometimes the #N/A is not created by your formula at all: it arrives from a cell you refer to. A forecast sheet might use =NA() for months without data, or an earlier lookup column may contain #N/A. Any SUM, AVERAGE or arithmetic over that range inherits the error.

D2fx=SUM(B2:B5)
ABCD
1MonthSalesTotal
2Jan1200#N/A
3Feb1350
4Mar#N/A
5Apr1100

B4 contains #N/A, so the total is #N/A too.

Result: #N/A

Fix. Fix the source if it is a real problem. If the #N/A is intentional (for example to keep a chart from plotting a zero), total the range with AGGREGATE, which can skip errors:

D2fx=AGGREGATE(9, 6, B2:B5)
ABCD
1MonthSalesTotal
2Jan12003650
3Feb1350
4Mar#N/A
5Apr1100

Function 9 is SUM, option 6 ignores error values: 1200 + 1350 + 1100 = 3650.

Result: 3650

Tip. #N/A is the one error that is useful in charts. A line chart does not plot #N/A points as zero (how the gap is drawn is set under Select Data › Hidden and Empty Cells), so =IF(B2="", NA(), B2) keeps an unfinished year from plunging to the axis.

How to find every #N/A in a workbook

  1. Go To Special. Press F5 or Ctrl+G (the same on a Mac), click Special, choose Formulas and leave only Errors ticked, then OK. Excel selects every formula on the sheet that shows an error, of any kind. Give the selection a fill colour so the cells stay visible after you click away.
  2. Find All. Press Ctrl+F (Cmd+F), type #N/A, open Options, set Look in to Values, tick Match entire cell contents, set Within to Workbook and click Find All. The list at the bottom shows sheet, cell and formula for every hit; Ctrl+A inside the list selects them all.
  3. Error Checking. Formulas › Formula Auditing › Error Checking jumps from one error to the next and offers Show Calculation Steps, which opens Evaluate Formula on that cell so you can see the exact step that fails.
  4. Trace Error. Select an error cell and choose Formulas › Error Checking (the arrow beside it) › Trace Error. Red arrows lead back to the cell where the error started; blue arrows show the healthy inputs. Errors travel downstream, so fixing the first cell often clears dozens of others.
  5. Count them with a formula. =COUNTIF(B2:B500, "#N/A") counts the cells in a range that show this error, and =SUMPRODUCT(--ISERROR(B2:B500)) counts every kind of error. Put the count next to a report total as an early-warning light.
  6. Highlight them. Select the data, choose Home › Conditional Formatting › New Rule › Use a formula and enter =ISNA(F2) (adjusted to the top-left cell). Every #N/A turns red and stays red as data changes.

IFNA, IFERROR and ISNA: catching #N/A properly

ToolWhat it catchesUse it when
XLOOKUP if_not_foundOnly a failed matchYou use XLOOKUP (Microsoft 365, Excel 2021+)
IFNAOnly #N/AWrapping VLOOKUP, MATCH, INDEX/MATCH (Excel 2013+)
ISNATests for #N/A, returns TRUE/FALSEConditional formatting, counting, very old versions: =IF(ISNA(x), "", x)
IFERROREvery errorOnly when any error genuinely means the same thing

Prefer the narrowest tool. =IFERROR(VLOOKUP(...), 0) also swallows #REF! when someone deletes a column and #NAME? when a range name disappears, and it turns them into a believable 0 that ends up in totals.

When you should NOT hide #N/A

  • Reconciliations and master-data checks. When you look up every invoice line in the customer list, an #N/A is the finding: a customer that is missing from the master data. Replacing it with blank or 0 hides exactly what the check was built to show.
  • Prices and rates that feed totals. Turning a missing price into 0 makes an invoice cheaper without anyone noticing. Show a clear text such as "Price missing" instead, which also stops the total from calculating.
  • While you are still building the sheet. Leave the raw errors visible until every formula is right; add the friendly messages last.
  • When you have not checked Causes 2 to 4. If items you know exist return #N/A, the problem is spaces, types or ranges, not missing data. Hiding the error leaves wrong numbers.

Version notes

  • #N/A exists in every version of Excel and in Google Sheets, LibreOffice and Numbers.
  • IFNA arrived in Excel 2013. In Excel 2010 and earlier use =IF(ISNA(x), alternative, x).
  • XLOOKUP and XMATCH need Microsoft 365, Excel 2021 or later, or Excel for the web. Opened in Excel 2019 or older they show #NAME? (#NAME? error in Excel: causes and how to fix it).
  • Padding mismatched arrays with #N/A (Cause 7) is dynamic-array behaviour from Microsoft 365 and Excel 2021+.

Check yourself

1. =VLOOKUP("P-102", A2:C9, 3, FALSE) returns #N/A, but you can see P-102 in A5. What is the most likely cause?

2. Which function replaces only #N/A and lets other errors through?

3. A formula works in F2 but returns #N/A after you fill it down to F3 and F4. What should you check first?

4. Why might you deliberately put =NA() in a cell?

More excel errors