Google Sheets function · Logical
IFNA in Google Sheets: syntax and examples
IFNA checks a value and, if it is #N/A, returns the fallback you give. Any other result, including other errors, passes through. It is the safe choice around lookups, because it hides a missing key but not a broken formula.
Syntax
IFNA(value, value_if_na)
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
value | any | yes | The formula or value to evaluate. Only a #N/A result is replaced. |
value_if_na | any | yes | What to return when value is #N/A. It can be text, a number or another formula. |
Examples
The examples use this table, starting in A1:
| Order | Customer | Total |
| GT1001 | Ana | 120 |
| GT1002 | Mihai | 80.5 |
| GT1003 | Ioana | 200 |
=IFNA(VLOOKUP("GT1002", A2:C4, 3, FALSE), "no order")Result: 80.5
The key exists, so IFNA passes the lookup result through unchanged.
Run in a Google Sheet (English US locale) on .
=IFNA(VLOOKUP("GT9999", A2:C4, 3, FALSE), "no order")Result: no order
The key is missing, VLOOKUP gives #N/A and IFNA swaps it for your text.
Run in a Google Sheet (English US locale) on .
=IFNA(MATCH("Dan", B2:B4, 0), 0)Result: 0
A name that is not in the list: MATCH fails with #N/A, so the result is 0.
Run in a Google Sheet (English US locale) on .
=ARRAYFORMULA(IFNA(VLOOKUP({"GT1001"; "GT7777"; "GT1003"}, A2:C4, 2, FALSE), "-"))Result:
| Ana |
| - |
| Ioana |
Three keys at once. Only the unknown one becomes a dash, the others keep their name.
Run in a Google Sheet (English US locale) on .
=IFNA(XLOOKUP("GT9999", A2:A4, C2:C4), 0)Result: 0
XLOOKUP without a missing_value also returns #N/A, so IFNA can turn it into a number.
Run in a Google Sheet (English US locale) on .
Common errors
- Only #N/A is replaced. #DIV/0!, #REF! and #VALUE! still show up, which is the point: they point at a real bug.
- A wrong column index in VLOOKUP gives #REF!, so IFNA will not hide it. IFERROR would, and the mistake would go unnoticed.
- The fallback is plain text, so a downstream SUM over a column of fallbacks needs a number such as 0, not "-".
- For an empty-looking fallback, write "" as the second argument. It returns an empty string, not a zero.
Compared with Excel
IFNA exists in Excel 2013 and later with the same two arguments.