Excel IF NOT NA: Formula That Skips #N/A Errors
In this article
The formula you want is =IF(NOT(ISNA(A1)),"OK","Missing"), or the shorter equivalent =IF(ISNA(A1),"Missing","OK") — both test whether a cell holds the #N/A error and return one result when it does and another when it does not. In practice most people reach for this pattern when they want to run a calculation or a lookup only on cells that actually contain a match, and skip the ones that failed. Put plainly: IF(NOT(ISNA(...))) means "if this is not an #N/A error, do the good thing; otherwise do the fallback."
One important framing first: there is no single built-in function called "IF NOT NA" in Excel. What exists is a combination of three functions — IF, NOT and ISNA — that together express that logic. Excel also has IFNA, which is a different function (it wraps a whole formula and substitutes a value when that formula produces #N/A), and IFERROR, which catches every error, not just #N/A. Knowing which of the three you actually need is the difference between a formula that works and one that hides real problems. Also note that ISNA exists in Excel for Windows, Mac, Excel for the web and Google Sheets, so the pattern works the same in all of them, though function names look slightly different in localized versions of Excel.
What You'll Need
- Excel (any recent version, Windows or Mac), Excel for the web, or Google Sheets — the formula pattern is identical in all of them.
- A cell that may contain #N/A, or a lookup formula that may return it (typically a VLOOKUP, XLOOKUP, INDEX/MATCH, MATCH or HLOOKUP).
- A clear idea of what you want in each of the two branches: the value when the test passes, and the value when it does not.
- An empty cell off to the side where you can build the formula before overwriting anything.
Step-by-Step
Build the test on its own first. Click an empty cell and type
=ISNA(A1), replacing A1 with the cell you are interested in. Press Enter. You should see either TRUE or FALSE. If you see TRUE, that cell contains an #N/A error. If you see FALSE, it holds a real value (or a different error — ISNA only recognizes #N/A). This one step tells you whether the rest of the formula will do what you expect.Wrap it in NOT. Edit the same cell to
=NOT(ISNA(A1)). Now the result flips: TRUE means "not an #N/A error," FALSE means "it is one." NOT simply reverses TRUE and FALSE, which is why the combined test reads the way it does in plain English.Add the IF and both outcomes. Change the formula to
=IF(NOT(ISNA(A1)),"Good","Missing"). The first argument is the test, the second is what to return when the test is TRUE, and the third is what to return when it is FALSE. Use your own labels or values: a number, a text label, a reference to another cell, or another formula. Remember that any literal text must be inside double quotes, while numbers and cell references are not.Swap the placeholder for your real check. Usually you are not testing a plain cell but the result of a lookup, such as
=VLOOKUP(A1,Sheet2!A:B,2,FALSE). Put that whole expression wherever you had A1:=IF(NOT(ISNA(VLOOKUP(A1,Sheet2!A:B,2,FALSE))),VLOOKUP(A1,Sheet2!A:B,2,FALSE),"Not found"). This is correct but repeats the lookup, so it does the same work twice.Copy down the column. Drag the fill handle (the small square at the bottom-right of the selection) down the column, or copy the cell and paste it into the range. Relative references shift with each row; if part of the formula must stay fixed, press F4 on Windows (Fn+F4 or Cmd+T on Mac, depending on keyboard layout) to add the $ signs before you copy.
Consider the cleaner alternative. Excel's
IFNAfunction replaces the entire IF/NOT/ISNA pattern with one call:=IFNA(VLOOKUP(A1,Sheet2!A:B,2,FALSE),"Not found"). It evaluates the lookup once and returns your fallback only when the result is #N/A. It is shorter, faster and easier to read. Use the IF(NOT(ISNA())) pattern only if you are on a very old version, need to distinguish a genuine match from an error in a more elaborate way, or the rest of your workbook already uses it.Verify the branches both work. Change the lookup value to something you know exists, then to something you know does not. Both cells should show the expected result, and neither should show #N/A. If the "good" branch still shows an error, the problem is in the inner formula, not the test — click the cell and check the formula bar.
Common Mistakes
- Testing the wrong error. ISNA detects only #N/A. If the cell contains #VALUE!, #REF!, #DIV/0! or #NAME?, ISNA returns FALSE and your formula reports "not an #N/A error" even though something is broken. For a blanket catch,
ISERRORorIFERRORis the right tool; for a single specific error,IF(ISERROR(x))tests them all, not just one. - Forgetting the quotes.
=IF(NOT(ISNA(A1)),Good,Missing)returns #NAME? because Excel reads Good and Missing as undefined names. Text results need double quotes; only numbers and TRUE/FALSE can be written bare. - Writing IF NOT NA as a single word or function. Typing
IFNOTNAor=NOTNA(A1)produces #NAME?. There is no such function. Spell out the nested form, or use IFNA. - Mismatched parentheses. Each opening bracket needs a closing one. The pattern
=IF(NOT(ISNA(A1)),x,y)has three closing brackets at the end; dropping one gives the generic "there's a problem with this formula" alert. - Assuming blank cells are caught. An empty cell is not an #N/A error, so ISNA returns FALSE for it. If you need to catch both blanks and errors, add a test:
=IF(OR(A1="",ISNA(A1)),"Missing","Good"). - Using IFNA/IFERROR to hide real problems. Wrapping every lookup in a fallback can mask a misspelled range or a reference that has been deleted, and you will never notice the data is wrong. Check the underlying formula separately before you wrap it.
Tips
- Excel's Formula AutoComplete suggests
ISNAas you type; pick it from the list to avoid typos. - Press F9 on a selected portion of a formula (in the formula bar) to see its current result — a quick way to check whether the inner lookup is really returning #N/A.
- If you only need to suppress the display of #N/A and do not care why it happened, formatting does not help — use IFNA or the "Replace #N/A with" option under conditional formatting if your version offers it (labels vary by version and region).
- Conditional formatting can highlight every cell containing #N/A: create a rule with the formula
=ISNA(A1)and your preferred fill colour. This is often more useful than hiding the error, because you can see where data is missing. - In Google Sheets the same functions exist with the same names, so formulas copy across with no edits except for array/function locale differences.
Troubleshooting
- #NAME? appears. A function name is misspelled, text is missing quotes, or you used a function the file's format does not support. Check for
IFNOTNAor unquoted labels first. - The formula always returns the fallback. Run the inner test alone (just
=ISNA(A1)) to see what it says. If it returns TRUE when the cell looks fine, the cell probably contains a formula that produced #N/A, not a real value. - The formula always returns the "good" value. This is common when the lookup range has been accidentally restricted or a sheet reference has changed. Check the referenced range and confirm the lookup value exists in the first column of that range.
- #N/A still shows through. You may be wrapping the wrong cell, or the error is appearing in the range your lookup depends on rather than in the lookup result itself. Wrapping a reference to a broken cell does not fix the broken cell.
- Circular reference warning. Your formula points back at its own cell. Move the test to a different column.
- Nothing recalculates. Press F9 (or Ctrl+Alt+F9 for a full rebuild) or check that calculation is set to Automatic under Formulas in the ribbon; the exact wording varies by version.
Frequently Asked Questions
Is there an IF NOT NA function in Excel?
No. You combine IF, NOT and ISNA, as in =IF(NOT(ISNA(A1)),x,y), or use the built-in IFNA, which handles the most common case in one function.
What is the difference between IFNA and ISNA?
ISNA returns TRUE or FALSE for a single value. IFNA(value, value_if_na) runs a whole expression and substitutes a fallback only when that expression produces #N/A.
Why does my formula show #N/A even with the NOT test?
Because the error is being generated somewhere the test cannot reach — usually the test itself is fine but the value you return in the TRUE branch still contains an error. Check that branch on its own.
Does IF NOT NA catch blank cells?
No. A blank is not an error, so ISNA says FALSE. Add an empty-string check with OR if you need to treat blanks as missing, as shown above.
Should I use IFERROR instead?
IFERROR catches every error, which is faster to write but hides mistakes. Use IFNA or ISNA when you specifically want #N/A handling and want other errors to stay visible.