IFNA is not a lookup function itself; it is an error-handling function that you wrap around VLOOKUP (or other formulas) to replace #N/A errors with a custom message or value. For example, =IFNA(VLOOKUP(A2, B:C, 2, FALSE), "Not Found") returns “Not Found” instead of #N/A when the lookup value isn’t in the table. This article explains how IFNA works with VLOOKUP, when to use it, and how it compares to IFERROR.
What IFNA Actually Does
IFNA is a function introduced in Excel 2013 (and available in Excel 2016, 2019, 2021, and Microsoft 365). Its syntax is simple:
=IFNA(value, value_if_na)
The first argument is the formula or expression you want to evaluate. The second argument is what to return if that expression results in a #N/A error. If the expression returns any other value (including other errors like #VALUE! or #DIV/0!), IFNA passes it through unchanged—it does not catch those errors.
For VLOOKUP, the most common use is to handle missing lookup values. Suppose you have a product ID in cell A2 and a lookup table in columns B and C (with B containing IDs and C containing prices). The formula:
=IFNA(VLOOKUP(A2, B:C, 2, FALSE), "Price not listed")
If the ID in A2 exists in column B, VLOOKUP returns the price. If not, VLOOKUP returns #N/A, and IFNA replaces it with the text “Price not listed”.
Why VLOOKUP Returns #N/A
VLOOKUP returns #N/A when it cannot find the lookup value in the first column of the table array. This happens in two common scenarios:
- The lookup value genuinely doesn’t exist in the table.
- The lookup value exists but is formatted differently (e.g., text vs. number, or extra spaces).
When using FALSE or 0 for the range_lookup argument (exact match), VLOOKUP only finds exact matches. If you use TRUE or omit the argument, VLOOKUP does an approximate match, which rarely returns #N/A but can return incorrect results if the table isn’t sorted.
IFNA only catches the #N/A error, which is exactly the error VLOOKUP produces for a missing match. Other errors—like #REF! from a bad column index or #VALUE! from wrong data types—are not suppressed, which is usually desirable because those indicate real problems you should fix.
IFNA vs IFERROR: Which to Use?
IFERROR is a broader error handler. It catches all errors (#N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, etc.) and replaces them with the value you specify. For example:
=IFERROR(VLOOKUP(A2, B:C, 2, FALSE), "Error")
IFNA is narrower—it only catches #N/A. The choice depends on what you want to hide:
- Use IFNA if you only want to handle missing lookup values and want other errors to surface so you can debug them.
- Use IFERROR if you want a catch-all for any error, but be aware it can mask formula mistakes (e.g., a typo in a range name).
Best practice for VLOOKUP is typically IFNA, because a #N/A specifically means “not found,” which is a normal business condition. Other errors are usually bugs.
How to Use IFNA with VLOOKUP: Step-by-Step
Assume you have a list of employee IDs in column A (starting at A2) and a lookup table with IDs in column D and names in column E. You want to return the name for each ID, or “Unknown” if not found.
- Click in cell B2.
- Type:
=IFNA(VLOOKUP(A2, D:E, 2, FALSE), "Unknown") - Press Enter. The formula returns the name if found, or “Unknown” if not.
- Drag the fill handle down to copy the formula to other rows.
On Mac, the steps are identical. In Excel for the web, the same formula works. No special setup is needed.
Common Mistakes and How to Avoid Them
Several pitfalls trip up users when combining IFNA and VLOOKUP:
- Using IFNA with approximate match: If you omit the fourth argument or use TRUE, VLOOKUP rarely returns #N/A, so IFNA won’t trigger. Always use FALSE for exact matching.
- Wrapping the wrong function: Some users write
=VLOOKUP(IFNA(...), ...)which is incorrect. IFNA must be the outer function. - Not accounting for extra spaces: If the lookup value has trailing spaces, VLOOKUP won’t match. Use
=IFNA(VLOOKUP(TRIM(A2), D:E, 2, FALSE), "Unknown")to trim the lookup value. - Assuming IFNA catches all errors: It doesn’t. If you get #REF!, check the column index number.
Alternatives to VLOOKUP with IFNA
In modern Excel, you might prefer newer functions that handle missing values more elegantly:
- XLOOKUP (Excel 2021/365) has built-in “if_not_found” argument:
=XLOOKUP(A2, D:D, E:E, "Unknown")—no IFNA needed. - INDEX/MATCH with IFNA:
=IFNA(INDEX(E:E, MATCH(A2, D:D, 0)), "Unknown")—works in all versions. - IF with ISNA (older approach):
=IF(ISNA(VLOOKUP(A2, D:E, 2, FALSE)), "Unknown", VLOOKUP(A2, D:E, 2, FALSE))—verbose but works in Excel 2003 and earlier.
XLOOKUP is generally recommended for new workbooks because it’s simpler and more flexible, but IFNA+VLOOKUP remains valid and widely used.
Frequently Asked Questions
Can IFNA be used with other lookup functions?
Yes, IFNA works with any function that can return #N/A, including HLOOKUP, MATCH, and INDEX. For example, =IFNA(MATCH(A2, B:B, 0), "Not found") returns “Not found” if the value isn’t in column B.
Does IFNA work in Google Sheets?
Yes, Google Sheets has an IFNA function with the same syntax. The behavior is identical. However, XLOOKUP is not available in Google Sheets, so IFNA with VLOOKUP is a common pattern there.
What if I want to return a blank cell instead of text?
Use empty double quotes as the second argument: =IFNA(VLOOKUP(A2, B:C, 2, FALSE), ""). This returns an empty string, which looks blank.
Why does my IFNA formula still show #N/A?
Check that the second argument is correct and that the first argument is truly a VLOOKUP. Also, ensure the lookup value and table column are the same data type (e.g., both text or both numbers). If the error is actually #VALUE! or another type, IFNA won’t catch it.
Is IFNA faster than IFERROR?
Performance differences are negligible in typical spreadsheets. Both are efficient. The choice is about error-handling scope, not speed.
Related
- Split Method in String: How It Works
- Aa to AZ Column Number: Excel Column Letters Explained
- Complex SQL Queries: How to Write and Optimize Them
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel Running Total Formula: Easy Step-by-Step GuideThe simplest running total formula in Excel is =SUM($B$2:B2) entered in cell C2 and copied down, where column…
- Excel Custom Number Format: Round Values to MillionsYes. In Excel for Microsoft 365 on Windows, apply the custom number format #,##0,,"M" to display numbers in…
- Excel Filter Table Multiple Criteria: Practical MethodsTo filter an Excel table by multiple criteria, use the filter arrows in its column headings: set criteria…
- How to Copy Unique Values in Excel Without DuplicatesTo copy a deduplicated list in Microsoft Excel, enter the UNIQUE formula in an empty cell, then copy…
- DATEDIF in Excel: Calculate Years, Months, and DaysIn Excel for Microsoft 365, DATEDIF calculates the number of complete years, months, or days between two dates.…
- Excel IF Statement for Dates: Compare Dates and Set RulesWith due dates in A2:A20, enter a formula in B2 to label each date as overdue or not:…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.