Wrap your lookup in IFNA, for example =IFNA(VLOOKUP(A2,Prices,2,FALSE),0), and Excel shows 0 only where the result would have been #N/A. With XLOOKUP, put the 0 in its built-in if_not_found argument instead: =XLOOKUP(A2,Items,Prices,0).
These formulas work in Excel for Microsoft 365 on Windows and Mac and in Excel for the web. XLOOKUP isn’t available in Excel 2016 or Excel 2019.
Why Excel shows #N/A
#N/A means a formula couldn’t find what it was asked to look for. Microsoft lists lookup functions (XLOOKUP, VLOOKUP, HLOOKUP, LOOKUP and MATCH) as the most common source. The usual reasons are: Unit conversions can return it too, because CONVERT shows #N/A when a unit name is misspelled or capitalized, as the steps to convert mm to inches in Excel explain.
- The value really isn’t there. Jordan looks up “Banana” in a price list that has no Banana row.
- Numbers stored as text. The lookup value is the number 1042 but the list holds the text “1042”, so they don’t match.
- Extra spaces. “Apple ” with a trailing space doesn’t match “Apple”. The TRIM function removes leading and trailing spaces.
- Approximate match on an unsorted list. VLOOKUP with TRUE (or with the last argument left out) can return #N/A or a wrong answer. Use FALSE for an exact match.
Check these first. If the missing value is a real mistake, a 0 hides it. If a missing match is expected (a product with no sales yet, say), showing 0 is the right fix.
Show 0 instead of #N/A with IFNA
IFNA takes two parts: the formula to check, and what to show if that formula returns #N/A. Its syntax is IFNA(value, value_if_na). Here’s how to add it to an existing VLOOKUP in cell C2:
- Click the cell that shows #N/A, for example C2, and press F2 to edit it. Your formula appears, such as =VLOOKUP(A2,$E$2:$F$50,2,FALSE).
- Click just after the equal sign and type IFNA(.
- Press End to jump to the end of the formula and type ,0) (a comma, a zero and a closing parenthesis).
- Press Enter. The formula now reads =IFNA(VLOOKUP(A2,$E$2:$F$50,2,FALSE),0), and the cell shows 0 if there’s no match or the looked-up value if there is one.
- Copy the formula to the rest of the column: double-click the fill handle (the small square at the cell’s bottom-right corner), or select the cell plus the cells below and press Ctrl+D.
The dollar signs in $E$2:$F$50 keep the lookup range fixed as you copy down; only A2 changes to A3, A4 and so on. For more ways to copy one formula down a long column, see how to fill a column with the same value or formula in Excel. If dollar signs also appear in front of the results themselves, that’s a currency format, and you can hide the dollar sign in Excel without changing the values.
If your data is formatted as an Excel table, you only need to edit the first cell. Tables copy a formula down the whole column on their own as a calculated column. (That automatic fill can also be switched off; see turning off autofill in Excel.)
Use XLOOKUP’s if_not_found argument
XLOOKUP has the fallback built in, so it doesn’t need a wrapper. Its syntax is =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], …). Put 0 in the fourth position:
=XLOOKUP(A2,$E$2:$E$50,$F$2:$F$50,0)
Microsoft’s XLOOKUP function reference says that when no valid match is found and if_not_found is left out, #N/A is returned. XLOOKUP also matches exactly by default, which removes the approximate-match problem above. If someone opens your file in Excel 2016 or 2019, XLOOKUP won’t work there, so stick with IFNA and VLOOKUP for files shared with those versions.
IFNA or IFERROR: which should you use?
Many older tutorials use =IFERROR(VLOOKUP(…),0). It works, but it does more than you might want. According to Microsoft’s IFERROR function page, IFERROR replaces #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. So if Alex mistypes a function name or deletes a column the lookup depends on, IFERROR quietly shows 0 instead of #NAME? or #REF!, and the mistake goes unnoticed.
- Use IFNA when the only error you expect is “not found”. Other errors still show, so real problems stay visible.
- Use IFERROR when other errors are expected and harmless, for example a division where some rows have 0 units: =IFERROR(B2/C2,0).
Either way, the cell now holds a real 0, not just a picture of one. SUM, AVERAGE and charts will use that 0 in their math. That matters for budgets too: a holiday gift list in Excel can only total its prices if no lookup cell in the column is showing #N/A.
Show a blank or a message instead of 0
The second argument can be anything. Use “” (two double quotes) for a blank-looking cell, or text in quotes for a message:
- =IFNA(VLOOKUP(A2,$E$2:$F$50,2,FALSE),””)
- =IFNA(VLOOKUP(A2,$E$2:$F$50,2,FALSE),”Not found”)
The choice matters for totals. Microsoft’s AVERAGE help says text and empty cells are ignored but cells with the value zero are included. Suppose Priya looks up five monthly figures and two are missing: with 0 the average counts five values, with “” it counts three. Use 0 when a missing match truly means zero (no sales), and “” or a message when it means “unknown”.
Type 0 without quotes. “0” in quotes is text, so it looks like a zero but SUM and AVERAGE skip it.
Find every #N/A in a sheet
Before you start editing, you can select all error cells at once to see how many there are:
- Select the range to check, or one cell to search the whole sheet.
- Go to Home > Find & Select > Go To, or press Ctrl+G, and select Special.
- Choose Formulas, leave only Errors checked below it, and select OK.
Excel selects every formula that currently returns an error. This selects all error types, not only #N/A.
Find and Replace can’t do this job. Microsoft notes that on the Replace tab, Look in offers only Formulas, so Excel searches the formula text, where “#N/A” doesn’t appear. Wrapping the formula is the reliable fix.
Hide #N/A without changing the formula
Microsoft’s page on hiding error values and error indicators describes several display-only options. The value in the cell is still #N/A, so formulas that use it still return #N/A. Fixing the source cell matters even more if you show a formula result in a text box, because a linked box repeats whatever the cell displays, #N/A included.
- Make errors invisible: select the cells, then Home > Conditional Formatting > Manage Rules > New Rule. Choose Format only cells that contain, pick Errors in the first list, select Format, and set the font color to white (or your background color).
- PivotTables: on the PivotTable Analyze tab, select Options, open Layout & Format, check For error values show, and type 0 (or leave the box empty for blanks).
- Printouts: in Page Layout, open the Page Setup dialog launcher, go to the Sheet tab and set Cell errors as to <blank>, — or #N/A.
- Green triangles: the small error indicator in a cell’s corner goes away if you clear Enable background error checking under File > Options > Formulas. That turns off checking for every workbook, so use it sparingly.
Common questions about #N/A in Excel
Why does my SUM show #N/A?
One #N/A in the range is enough to make SUM, AVERAGE and most other math functions return #N/A too. Fix the lookup cells with IFNA, and the total recalculates on its own.
Can I make a line chart skip missing points instead of dropping to 0?
Often, yes. A 0 is plotted as a real point, so a line dips to the axis. For line, scatter and radar charts, Microsoft documents a setting for #N/A cells: click the chart, choose Select Data > Hidden and Empty Cells, and use Show #N/A as an empty cell or connect the points with a line. Microsoft notes that the #N/A option is off by default and may not be in every Microsoft 365 build yet. In that case, keep #N/A in the chart’s source cells (the NA() function returns it on purpose) and use 0 only in the cells you total.
My workbook has to open in a very old version of Excel. What then?
If a version doesn’t recognize IFNA (the cell shows #NAME?), use the older pattern =IF(ISNA(VLOOKUP(A2,$E$2:$F$50,2,FALSE)),0,VLOOKUP(A2,$E$2:$F$50,2,FALSE)). It runs the lookup twice, so it’s slower on big sheets, but it gives the same result.
If you’re tidying up a sheet before sharing it, you may also want to turn off Show Formulas in Excel so every cell displays its result.
Matthew Burleigh has been a freelance writer since the early 2000s. You can find his writing all over the Web, where his content has collectively been read millions of times.
Matthew received his Master’s degree in Computer Science, then spent over a decade as an IT consultant for small businesses before focusing on writing and website creation.
The topics he covers for MasterYourTech.com include iPhones, Microsoft Office, and Google Apps.
You can read his full bio here.