Exceljet

Quick, clean, and to the point

Excel IFNA Function

Excel IFNA function
Summary 

The Excel IFNA function is a simple way to trap and handle #N/A errors specifically without catching other errors. The IFNA function returns a custom result when a formula generates the #N/A error, and a normal result when no error is detected.

Purpose 
Trap and handle #N/A errors
Return value 
The value supplied for #N/A errors
Syntax 
=IFNA (value, value_if_na)
Arguments 
  • value - The value, reference, or formula to check for an error.
  • value_if_na - The value to return if #N/A error is found.
Version 
Usage notes 

The IFNA function is a simple way to trap and handle #N/A errors specifically without catching other errors.  You can use the IFNA function to trap and handle #N/A errors that may occur in formulas that perform lookups with MATCH, VLOOKUP, HLOOKUP, XLOOKUP, etc. The IFNA function returns a custom result when a formula generates the #N/A error, and a normal result when no error is detected. IFNA will only handle #N/A errors –other errors will still display. 

Example

The IFNA function can be used to trap #N/A errors that may occur with the VLOOKUP function. In the example shown, the formula in F5, copied down, is:

=IFNA(VLOOKUP(E5,xtable,2,0),"Not found")

where xtable is the named range B5:C12. When the lookup value in column E is found in xtable, VLOOKUP returns the exchange range normally. When the lookup value is not found, VLOOKUP returns #N/A, and IFNA catches this error and returns "Not found".

IFERROR or IFNA?

The IFERROR function is a useful function, but it is a blunt instrument, since it will trap many kinds of errors. For example, if there's a typo in a formula, Excel may return the #NAME? error, but IFERROR will suppress the error and return the alternative result. This can obscure an important problem. In many cases, it makes more sense to use the IFNA function, which only traps the #N/A error.

Other error functions

Excel provides a number of error-related functions, each with a different behavior:

Notes

  • If value is empty, it is evaluated as an empty string ("") and not an error.
  • If value_if_na is supplied as an empty string (""), no message is displayed when an error is detected.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.