Sub topic 11
IFNA: Catching Only #N/A
This chapter assumes you can enter and edit formulas in Google Sheets, use cell references and ranges such as B2 and A:A, and write a basic IF. It also assumes you have met IFERROR in the previous chapter and know what the common error values mean. Here you will learn how IFNA differs from IFERROR, when that difference matters, and how to use it safely in lookups and IFS formulas.
What IFNA does
IFNA takes two arguments. The first is a formula or value to evaluate. The second is the value to return if the first result is exactly the #N/A error. If the first argument produces any other result, including a different error, IFNA passes it through unchanged.
=IFNA(value, value_if_na)#N/A means "not available". In Google Sheets it usually signals that something was looked for and not found. Lookup functions such as VLOOKUP, HLOOKUP, MATCH, and XLOOKUP return it when there is no match. An IFS formula returns it when no condition is true and there is no fallback.
This is the key idea. #N/A often describes an expected situation, such as a missing record. Other errors, such as #REF! or #NAME?, usually describe a mistake in the formula. IFNA lets you handle the first kind and still see the second kind.
IFNA compared with IFERROR
IFERROR replaces every error type. IFNA replaces one.
| Formula result | `IFERROR(x, "fallback")` | `IFNA(x, "fallback")` |
|---|---|---|
| `#N/A` | fallback | fallback |
| `#DIV/0!` | fallback | `#DIV/0!` |
| `#VALUE!` | fallback | `#VALUE!` |
| `#REF!` | fallback | `#REF!` |
| `#NAME?` | fallback | `#NAME?` |
| `#NUM!` | fallback | `#NUM!` |
| A normal value | the value | the value |
Both functions leave normal results untouched. They differ only when the formula returns an error.
A worked lookup example
Suppose a sheet named Prices holds product codes in column A and prices in column B. On another sheet, column A lists the codes customers ordered, and you want the price next to each one.
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"Not found")Walk through the possible outcomes:
- The code in
A2exists inPrices.VLOOKUPreturns the price, andIFNAshows it. - The code does not exist.
VLOOKUPreturns#N/A, andIFNAshowsNot found. - Someone deletes the
Pricessheet. The reference breaks and the formula returns#REF!.IFNAdoes not replace it, so you see the error and know something is broken.
Case 3 is why IFNA is the safer choice here. With IFERROR, every row would quietly show Not found, and nothing would tell you the whole lookup had failed.
Returning a number or blank as the fallback
The fallback does not have to be text. Pick the value that suits the next step in your sheet.
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),0)A fallback of 0 keeps the column numeric, so a SUM over it still works. Be careful, though. A price of 0 can be mistaken for a real free item. If the distinction matters, use an empty string instead:
=IFNA(VLOOKUP(A2,Prices!A:B,2,FALSE),"")An empty string displays as a blank cell. Note that it is text, not a true empty cell. SUM ignores it, but A2+1 on a cell holding "" returns #VALUE!, and ISBLANK returns FALSE for it.
Where #N/A comes from
Knowing the sources helps you decide whether IFNA fits.
- Lookup with no match.
VLOOKUP,HLOOKUP,LOOKUP,MATCH, andXLOOKUPreturn#N/Awhen the search key is absent. - Exact-match mismatches. A key that looks the same may differ by a trailing space, different capitalization in a case-sensitive comparison, or text versus number.
"1001"and1001do not match. - IFS with no true condition.
=IFS(B2>=90,"A",B2>=80,"B")returns#N/Afor a score of 75. - SWITCH with no match and no default. Without a final default argument, an unmatched value returns
#N/A. - Deliberate use of
NA(). TheNA()function returns#N/Aon purpose. Charts skip#N/Apoints rather than plotting them as zero, so some people useNA()to leave gaps in a line chart.
Because IFS and SWITCH both return #N/A on unmatched input, IFNA is a natural way to supply a fallback without hiding other errors:
=IFNA(IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C"),"Below 70")A score of 75 returns C. A score of 60 matches nothing, so IFS returns #N/A and IFNA replaces it with Below 70. A score cell holding text like "absent" raises a comparison problem differently, discussed below.
A subtlety: text in a comparison
In Google Sheets, comparing text with a number using >= does not raise an error. Text is treated as greater than any number. So "absent">=90 evaluates to TRUE, and the IFS above would return A for a score cell containing the word "absent". IFNA cannot help here, because no error occurs. This is a case where the formula looks safe but gives a wrong answer. If non-numeric entries are possible, test for them first:
=IFNA(IFS(NOT(ISNUMBER(B2)),"Check score",B2>=90,"A",B2>=80,"B",B2>=70,"C"),"Below 70")The first condition catches blanks and text before the comparisons run. An empty cell is not a number, so it also gets Check score.
IFNA versus a TRUE fallback in IFS
You have already seen that a final TRUE condition gives IFS a catch-all. Both approaches handle unmatched scores, so which should you use?
- Final
TRUEcondition. The fallback is part of theIFSitself. Anything not matched by earlier conditions gets the fallback, including values you did not expect. It cannot distinguish "no condition matched" from other problems, because it never reports them. IFNAaroundIFS. The fallback applies only whenIFSitself returns#N/A. If one of the conditions causes a different error, such as#REF!, you still see it.
Be aware that an error inside a condition stops IFS before it reaches a later TRUE. For example, if a condition refers to a deleted range and returns #REF!, IFS returns that error and a final TRUE does not rescue it. This behavior is useful: broken formulas stay visible.
A caution on IFNA with IFS: if a condition itself evaluates to #N/A, for example IFS(VLOOKUP(...)>10, "high", ...) where the lookup misses, IFNA will replace that too, so you cannot tell a missed lookup from "no condition matched". When that distinction matters, handle the lookup separately in its own IFNA.
IFNA with SWITCH
SWITCH already has its own default, so IFNA is rarely needed around it. Use the built-in default when you want a fallback for unmatched input:
=SWITCH(A2,"NY","New York","CA","California","TX","Texas","Unknown")Use IFNA instead when you want unmatched values to be visible during development, then add a default later. Leaving off the default and wrapping the formula gives the same result as supplying one, so prefer the default. It is shorter and states the intent directly.
Nesting IFNA to try several sources
Because IFNA reacts only to a missing match, you can chain it to search several lists in order:
=IFNA(VLOOKUP(A2,Current!A:B,2,FALSE),IFNA(VLOOKUP(A2,Archive!A:B,2,FALSE),"Not found"))The formula checks Current first. If the code is missing there, it checks Archive. If it is missing in both, it returns Not found. A real error in either lookup, such as a deleted sheet, still appears. This pattern is clearer and safer than the same formula built with IFERROR.
Common mistakes
- Using IFNA when you want to catch divide-by-zero.
IFNA(C2/D2,0)does nothing for#DIV/0!. UseIFERRORhere, or better, test the divisor withIF(D2=0,0,C2/D2). - Expecting IFNA to fix mismatched keys. If a lookup returns
Not foundfor a code you can see in the list, the cause is usually a trailing space or a number stored as text. TryTRIM, or compareISNUMBER(A2)for both columns. - Forgetting the second argument. Unlike some functions,
IFNArequires both arguments.=IFNA(A2)produces a formula parse error. - Using a fallback that looks like real data. A fallback of
0or"None"can be mistaken for a genuine result when you later filter or total the column.
Summary
IFNA is a narrower tool than IFERROR. It replaces only #N/A, which in lookups, IFS, and SWITCH means "no match". Every other error still shows, so broken references and misspelled names stay visible. Use it where a missing match is an expected outcome, and keep IFERROR for the cases where you deliberately want to absorb every kind of failure.
Exercise
A sheet named Staff lists employee IDs in column A and departments in column B. In another sheet, cell A2 holds an ID. Write a formula that returns the department, or "Unassigned" when the ID is not in Staff. Explain what you will see if someone later deletes the Staff sheet.
Show answer
=IFNA(VLOOKUP(A2,Staff!A:B,2,FALSE),"Unassigned"). If the Staff sheet is deleted, VLOOKUP returns #REF!, which is not #N/A, so IFNA passes it through and the cell shows #REF!. With IFERROR you would see "Unassigned" instead and miss the problem.
Exercise
The formula =IFNA(C2/D2,0) is meant to return 0 when D2 is zero, but it shows #DIV/0!. Why, and how would you fix it?
Show answer
Dividing by zero produces #DIV/0!, not #N/A, so IFNA does not replace it. Use =IFERROR(C2/D2,0), or test the divisor directly with =IF(D2=0,0,C2/D2), which avoids hiding other errors.
Exercise
In =IFNA(IFS(B2>=90,"A",B2>=80,"B",B2>=70,"C"),"Below 70"), what is returned when B2 is 65, and what is returned when B2 contains the text "absent"?
Show answer
For 65, no condition is true, IFS returns #N/A, and IFNA returns "Below 70". For "absent", Sheets treats text as greater than any number, so B2>=90 is TRUE and the formula returns "A". No error occurs, so IFNA does nothing. Add a leading check such as NOT(ISNUMBER(B2)) to catch non-numeric entries.