Excel function

IFNAfunction

Returns a value you choose only when a formula gives #N/A; otherwise returns the formula result.

All versions
=IFNA(VLOOKUP(E2, $A$2:$C$5, 3, FALSE)*F2, "Check code")
A
B
C
D
E
F
G
H
1
2
3
4
5
6

Click a cell in the table to change Order row. Click the P009 order (not in the product table) and the P003 order (price "TBD"). Only #N/A is replaced; #VALUE! stays. Try breaking it on purpose to see the errors.

Result

6900

Order row
E2You can also click a cell in the table

The order whose price is looked up and multiplied by the quantity. Click another order code in column E.

value_if_na

The value to show when the code is not found. Leave it empty for a blank.

What is the IFNA function?

=IFNA(value, value_if_na)

IFNA returns a value you choose only when a formula gives the #N/A error, and otherwise returns the formula result. #N/A is the error VLOOKUP, MATCH and XLOOKUP give when they cannot find the value.

IFERROR hides every error, but IFNA replaces only #N/A. So you can handle "a code not in the list" cleanly while real problems, such as a #VALUE! from a price entered as text, stay visible.

Arguments

value
The formula to check for #N/A. Usually VLOOKUP or MATCH.
value_if_na
The value to return instead when value is #N/A. "" shows a blank.

IFNA examples

  1. Example 1. A message when not found

    =IFNA(VLOOKUP(E2, $A$2:$C$5, 3, FALSE), "Check code")

    A code not in the product table shows "Check code".

  2. Example 2. 0 when not found

    =IFNA(VLOOKUP(E2, $A$2:$C$5, 3, FALSE), 0)

    For a column you will total, use 0 so SUM does not break.

  3. Example 3. With MATCH

    =IFNA(MATCH(A2, list, 0), "None")

    Shows the position if it is in the list, or "None" if not.

Common mistakes

FAQ

Why use IFNA instead of IFERROR?
It handles only failed lookups and does not hide other errors, so data problems are not missed.
Is it needed with XLOOKUP?
XLOOKUP's fourth argument sets the value when nothing is found, so you can do without IFNA.