Skip to content

IFNA

Returns a value you choose only when a formula gives #N/A, and lets every other error show. It is the safer wrapper for lookups.

Syntax

=IFNA(, )

Logical

Excel 2013 and later, including Microsoft 365, Excel 2024, 2021, 2019 and 2016, Excel for the web and the mobile apps. Not available in Excel 2010 or earlier.

Try it

Edit the formula in B7 or change the inputs. The sheet recalculates as you type.

B7
A
B
C
D
1
Employee ID
Department
2
E-101
Finance
3
E-102
Logistics
4
E-103
IT
5
6
Find ID
Department
7
E-250
Not listed
8

B7 =IFNA(VLOOKUP(A7,A2:B4,2,FALSE),"Not listed") returns Not listed

How IFNA works

IFNA replaces the #N/A error with a value of your choice, and leaves every other result alone. =IFNA(VLOOKUP(A9, A2:C20, 3, FALSE), "Not listed") shows "Not listed" when the lookup doesn't find A9, and shows the real value otherwise.

What #N/A means

#N/A means "not available": a lookup found no match. It is the one error that is often expected, since a lookup value may truly be missing from a list. VLOOKUP, HLOOKUP, MATCH, XMATCH and LOOKUP all return it when nothing matches. NA() returns it on purpose.

IFNA or IFERROR

Both functions have two arguments, and both return the second when the first is an error. The difference is which errors count:

  • IFERROR replaces every error: #N/A, #VALUE!, #REF!, #DIV/0!, #NAME? and the rest.
  • IFNA replaces only #N/A.

For a lookup, that difference matters. Suppose someone deletes the column your VLOOKUP reads. The formula starts returning #REF!. With IFERROR, every row quietly shows "Not listed". With IFNA, the #REF! stays on screen, and you know something is broken. IFNA says exactly what you mean: "if the value isn't found, show this".

Modern alternatives

XLOOKUP has a built-in fourth argument, if_not_found, so =XLOOKUP(A9, A2:A20, C2:C20, "Not listed") needs no wrapper. XMATCH has no such argument, so =IFNA(XMATCH(...), 0) is still the usual way to give a not-found result a value. VLOOKUP, HLOOKUP, MATCH and LOOKUP have no built-in option, so IFNA is the standard answer for them.

Choosing the replacement

  • Text such as "Not listed" is best when a person reads the result.
  • 0 is convenient for sums, but a missing item then looks like a real zero.
  • "" leaves the cell looking blank, but it holds empty text, and arithmetic on it returns #VALUE!.
  • Another lookup is a common pattern: =IFNA(VLOOKUP(A2, Table1, 2, FALSE), VLOOKUP(A2, Table2, 2, FALSE)) searches a second list when the first has no match.

Compatibility

IFNA was added in Excel 2013. In Excel 2010 and earlier it returns #NAME?. If the file has to open there, use =IF(ISNA(formula), fallback, formula), which repeats the lookup, so it is slower.

Where #N/A should stay

Don't hide #N/A when the missing value is a data problem you want to find. A list of unmatched IDs is useful information. Consider counting the matches that failed with =SUMPRODUCT(--ISNA(range)) before you replace the errors with a message.

Arguments

value
The formula or reference to check, usually a lookup such as VLOOKUP(...) or MATCH(...).
value_if_na
What to return if value is #N/A: text such as "Not listed", a number such as 0, empty text "", or another formula. Any other error in value is returned unchanged.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

A not-found message for VLOOKUP

B7 =IFNA(VLOOKUP(A7,A2:B4,2,FALSE),"Not listed")

Result: Not listed

E-250 isn't in the list, so VLOOKUP returns #N/A and IFNA shows the message. A found ID would pass straight through.

B7
A
B
C
D
1
Employee ID
Department
2
E-101
Finance
3
E-102
Logistics
4
E-103
IT
5
6
Find ID
Department
7
E-250
Not listed
8

B7 =IFNA(VLOOKUP(A7,A2:B4,2,FALSE),"Not listed") returns Not listed

Example 2

Other errors still show

B7 =IFNA(VLOOKUP(A7,A2:B4,3,FALSE),"Not listed")

Result: #REF!

The table has two columns, so asking for column 3 returns #REF!. IFNA doesn't touch it, so the mistake is visible. IFERROR would have shown "Not listed".

B7
A
B
C
D
1
Employee ID
Department
2
E-101
Finance
3
E-102
Logistics
4
E-103
IT
5
6
Find ID
Department
7
E-102
#REF!
8

B7 =IFNA(VLOOKUP(A7,A2:B4,3,FALSE),"Not listed") returns #REF!

Example 3

Fall back to a second list

B6 =IFNA(VLOOKUP(A6,A2:B3,2,FALSE),VLOOKUP(A6,D2:E3,2,FALSE))

Result: 11.25

O-78 isn't in the current list, so the first lookup gives #N/A and IFNA runs the second lookup against the old list.

B6
A
B
C
D
E
F
1
Current code
Price
Old code
Price
2
N-10
12.5
O-77
9.9
3
N-11
14
O-78
11.25
4
5
Code
Price
6
O-78
11.25

B6 =IFNA(VLOOKUP(A6,A2:B3,2,FALSE),VLOOKUP(A6,D2:E3,2,FALSE)) returns 11.25

Example 4

Give a MATCH a number when nothing is found

D2 =IFNA(MATCH(C2,A2:A4,0),0)

Result: 0

MATCH returns #N/A when the ticket isn't listed, and IFNA turns that into 0, which you can test with IF(D2=0, ...).

D2
A
B
C
D
1
Ticket
Find
Position
2
TK-1
TK-9
0
3
TK-2
4
TK-3
5
6

D2 =IFNA(MATCH(C2,A2:A4,0),0) returns 0

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In B8, return the price for the SKU in A8, or Not listed if it isn't in the list. Let other errors show.

Answer in B8.

B8
A
B
C
D
E
F
1
SKU
Price
Bin
2
SKU-101
39
A-03
3
SKU-102
89
B-14
4
SKU-103
54
A-11
5
SKU-104
29
D-22
6
7
Find SKU
Price
Bin
8
SKU-300
9
10
11

Common mistakes

  • IFNA catches only #N/A. A #VALUE! or #DIV/0! inside value will still show, which is deliberate. Use IFERROR if you want to hide all errors, and accept the risk.
  • IFNA isn't available in Excel 2010 or earlier. There it returns #NAME?. Use IF(ISNA(...), ..., ...) instead.
  • Returning 0 as the fallback makes a missing item look like a real zero in totals. Prefer text, or "", where a person reads the result.
  • XLOOKUP and FILTER have their own not-found arguments. Wrapping them in IFNA is unnecessary.
  • Hiding #N/A can hide a data problem. Count the unmatched IDs first if you need to know how many there are.

Questions people ask

What is the difference between IFNA and IFERROR?

IFNA replaces only the #N/A error. IFERROR replaces every error. Prefer IFNA around lookups, so other mistakes such as #REF! or #NAME? aren't hidden.

How do I replace #N/A with 0?

Wrap the formula in IFNA with 0 as the second argument: `=IFNA(VLOOKUP(A2, F2:G20, 2, FALSE), 0)`. Keep in mind that a missing item then looks like a real zero.

Does IFNA work in Excel 2010?

No. It was added in Excel 2013. In older versions it returns #NAME?. Use `=IF(ISNA(formula), fallback, formula)` there.

Do I need IFNA with XLOOKUP?

No. XLOOKUP's fourth argument, if_not_found, returns your message when nothing matches.

Learn IFNA in a real sheet.

IFNA is taught in Logic and text, lesson 5: IFERROR and IFNA. Each lesson is a short, graded exercise like the one above.