Sub topic 11
IFNA: catching only #N/A
Assume you know how to enter Google Sheets formulas, use cell references, and write basic IF and lookup formulas. This chapter focuses on one decision: how to replace only the #N/A error while allowing other errors to remain visible.
What #N/A means
#N/A means that a formula could not find an expected value. Lookup functions commonly return it when there is no match.
For example, suppose A2 contains a product code and the Prices sheet contains product codes in column A and prices in column B:
=VLOOKUP(A2,Prices!A:B,2,FALSE)If the product code does not exist in Prices!A:A, the formula returns #N/A.
The error tells you something specific: the lookup did not find a matching row. You may want to show a friendlier message such as Not found, but you may still want other errors to remain visible.
Use IFNA for lookup misses
IFNA has this syntax:
=IFNA(value, value_if_na)valueis the formula to evaluate.value_if_nais the result to return only whenvalueproduces#N/A.
Wrap the lookup in IFNA:
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"Not found")If the product exists, the formula returns its price. If the product does not exist, it returns Not found.
The fallback can also be a number, a blank string, or another formula:
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),0)=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"")A blank string makes the cell appear empty, but the cell still contains a formula.
IFNA versus IFERROR
IFERROR catches every error value. IFNA catches only #N/A.
| Formula | Error it catches | Other errors |
|---|---|---|
| `=IFNA(A1/B1,"Not available")` | `#N/A` | Remain visible |
| `=IFERROR(A1/B1,"Not available")` | All errors | Replaced by fallback |
Consider this formula:
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"Not found")If the lookup range is accidentally changed to an invalid reference, such as Prices!A:Z with an invalid sheet name, the resulting error is not a lookup miss. IFNA leaves that error visible so you can fix the formula.
By contrast:
=IFERROR(VLOOKUP(A2,Prices!A:B,2,FALSE),"Not found")replaces #N/A, #REF!, #VALUE!, and other errors with the same text. That can make a broken formula look like an ordinary missing record.
How IFNA fits into a lookup
This flow shows the decision made by IFNA.
Combine IFNA with other logic
You can place IFNA around an IFS or SWITCH formula when the inner formula may perform a lookup or produce #N/A.
For example:
=IFNA(SWITCH(A2,"NY","New York","CA","California"),"Unknown state")Here, SWITCH returns the matching state name. If A2 does not match one of its cases and no default is supplied, SWITCH returns #N/A, so IFNA returns Unknown state.
You can also use IFNA inside a larger formula when only one lookup needs a fallback:
=IF(IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"")="","Review code","Ready")This treats a missing product as a review case while preserving unrelated formula errors.
Check the cause before adding a fallback
Before wrapping a formula with IFNA, decide whether #N/A is expected.
- Use it when a user-entered key may legitimately be absent.
- Use it when a report should show a clear missing-value message.
- Do not use it to hide a misspelled sheet name or an incorrect lookup range.
- Keep the fallback specific enough to explain what happened.
Exercise
Write a formula that looks up A2 in the first column of Prices and returns the value from the second column. It should display "Missing product" only when the lookup returns #N/A.
Show answer
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"Missing product")