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.
Trap and handle #N/A errors
The value supplied for #N/A errors
=IFNA (value, value_if_na)
value - The value, reference, or formula to check for an error.
value_if_na - The value to return if #N/A error is found.
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.
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:
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:
The ISERR function returns TRUE for any error type except the #N/A error.
When VLOOKUP can't find a value in a lookup table, it returns the #N/A error. The IFERROR function allows you to catch errors and return your own custom value when there is an error. If VLOOKUP returns a value normally...
The goal of this example is to look up the correct astrological or zodiac sign for a given birthdate, using the table shown in B5:F15. These are based on the Western zodiac signs described here. Zodiac signs are used in...
In this example, the goal is to make a noun plural when the number of items is greater than one. In many cases, a noun can be made plural by adding an "s". However, many nouns have an irregular plural form, and the main...
The Excel ISERROR function returns TRUE for any error type excel generates, including #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL! You can use ISERROR together with the IF function to test for errors and display a custom message, or...
The Excel IFERROR function returns a custom result when a formula generates an error, and a standard result when no error is detected. IFERROR is an elegant way to trap and manage errors without using more complicated nested IF statements.
The Excel ISNA function returns TRUE when a cell contains the #N/A error and FALSE for any other value, or any other error type. You can use the ISNA function with the IF function test for #N/A and display a friendly message if the error occurs...