Dealing with the #N/A Error in Excel
When working with Excel, you may encounter the #N/A error in two situations: either you want to avoid the #N/A error altogether, or you don’t want it to be visible to the user. This tutorial will guide you on how to handle these situations effectively.
Understanding the #N/A Error in Excel
The #N/A error in Excel stands for “Not Available.” It occurs when you use lookup functions to search for a value in a list or range, but the desired value is not found. In such cases, the formula will return the result as an #N/A error.
When Does the #N/A Error in Excel Occur?
For instance, in the example above, we used the VLOOKUP function to search for the value 7 in column A. However, since “7” is not present in the range, the formula returns #N/A as the result. Similarly, when using the MATCH function to find a match for “7,” the formula also returns #N/A.
Apart from VLOOKUP and MATCH, other lookup functions such as HLOOKUP, LOOKUP, and INDEX + MATCH can also yield the same error in Excel. However, XLOOKUP has an inbuilt argument that allows you to define the values to return if the searched value is not found in the lookup range.
How to Handle the #N/A Error
There are two specific functions you can use to deal with the #N/A error:
IFNA: Specifically for #N/A Error
In the following example, we wrapped the MATCH function with IFNA. The IFNA function takes the MATCH function as its first argument and specifies the value to return if the MATCH function encounters the #N/A error in Excel.
IFERROR: Handles All Errors
In the next example, we used IFERROR with VLOOKUP. By wrapping VLOOKUP with IFERROR, we defined the value to return in case of any error in the VLOOKUP result.
Additional Points to Remember
It’s important to verify the value you are searching for using any lookup function. Misspelling the value might prevent you from finding the correct match.
Sometimes, the #N/A error occurs when the values you are searching for have a different format from those in the lookup range. For example, if you are searching for a number but it is stored as text in the lookup range, you will still encounter the #N/A error.
Extra spaces in the lookup value or the values in the lookup table can also lead to a #N/A error.
By considering these points and using the IFNA and IFERROR functions appropriately, you can effectively handle the #N/A error in Excel.