NA Function in Excel

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The NA function returns the #N/A error, on purpose. Excel uses #N/A to mean “no value is available”, and NA lets you put that signal in a cell yourself.

That’s handy whenever a value is missing. A blank or a zero can pass for real data, but a #N/A makes it obvious that something isn’t there yet, both to you and to every formula that uses the cell.

In this article, I’ll show you how NA works, how to use it with IF, how to calculate around #N/A values, and how it keeps missing data from showing up as zeros in a chart.

Follow along with the example file

NA Function Examples.xlsx

Download

NA Function Syntax

Here is the syntax of the NA function:

=NA()

It has no arguments and always returns the same thing, the #N/A error.

You still need to type the empty parentheses, though. Without them, Excel doesn’t run the function, so =NA gives you a #CALC! error in Excel 365 instead of #N/A.

The NA function works in all Excel versions, including 365, 2024, 2021, 2019, 2016, Mac, and the web.

When to Use the NA Function

Use this function when you need to:

  • Mark a value as missing so it can’t be mistaken for a zero or a blank.
  • Make a total show #N/A until all its inputs are in.
  • Return #N/A from an IF formula when an input cell is empty.
  • Leave gaps in a line chart instead of plotting missing values as zero.
  • Plot or highlight a single point in a chart, such as the highest month.

Let me show you a few practical examples of how to use NA.

Example 1: Mark a Missing Value With the NA Function

Let’s start with a simple example.

Below is a list of trip expenses where the car rental bill hasn’t arrived yet, and I want to mark that amount as missing in cell B4 and get the total in cell B11.

Trip expenses with the Car Rental amount missing and an empty Total cell

Here is the formula I’ll enter in cell B4:

=NA()
NA formula in B4 marking the missing car rental amount as #N/A

Cell B4 now shows #N/A, which makes it clear that the car rental amount isn’t available yet.

Now here is the formula for the total in cell B11:

=SUM(B2:B9)
SUM formula in B11 returning #N/A because the car rental amount is #N/A

The SUM function returns #N/A, because one of the cells it adds is #N/A. That’s exactly what we want here, since the total refuses to show a number until the car rental amount comes in.

If I had left B4 blank instead, SUM would quietly return $1,415. Anyone looking at the sheet would assume that’s the full cost of the trip, when it’s missing the car rental.

The #N/A spreads to any formula that uses B4, not just SUM. Even =OR(TRUE,B4) returns #N/A instead of TRUE, so when a result shows #N/A, trace it back to a missing input.

You can also type #N/A directly into the cell and get the exact same error, so either way works here.

Example 2: Use NA With IF to Flag Missing Inputs

Here’s another practical scenario.

Below is a grocery price check with last month’s and this month’s price for each item (a few items haven’t been checked yet this month), and I want the price change in column D.

Grocery prices for last month and this month, with three items not checked yet and an empty Change column

If you just subtract last month’s price from this month’s, the empty cells count as 0. Eggs would show a change of -$4.25, which looks like the price dropped to nothing, when nobody has checked it yet.

Here is a formula that returns #N/A for those items instead:

=IF(C2:C11="",NA(),C2:C11-B2:B11)
IF and NA formula returning the price change, or #N/A where this month's price is missing

The IF function checks each cell in C2:C11. When this month’s price is empty, it returns NA(), and otherwise it subtracts last month’s price from this month’s price.

Since the formula works on whole ranges, the results spill into D2:D11 on their own.

With NA(), Eggs, Coffee, and Cheddar Cheese show #N/A instead. The missing prices are easy to spot, and they can’t sneak into an average price change later.

Checking for "" also works if this month’s prices come from another formula that returns empty text for unchecked items. The ISBLANK function wouldn’t, because Excel doesn’t treat a cell holding “” as blank, and the subtraction would give a #VALUE! error.

If you are using Excel 2019 or earlier, enter the below formula in cell D2 and then copy it down the range:

=IF(C2="",NA(),C2-B2)

Example 3: Average and Count Values That Include #N/A

Now let’s see how to calculate around #N/A values.

Below is a sleep log where the nights the sleep tracker wasn’t worn are marked with =NA(), and I want the average hours slept in cell B13 and the number of untracked nights in cell B14.

Sleep log with three untracked nights marked #N/A and empty average and count cells

A plain =AVERAGE(B2:B11) returns #N/A here, for the same reason the total did in Example 1. So we need a formula that skips the #N/A cells.

Here is the formula for the average:

=AVERAGEIF(B2:B11,"<>#N/A")
AVERAGEIF formula skipping the #N/A nights and returning 7.3 hours

This returns 7.3 hours. The criteria “<>#N/A” tells the AVERAGEIF function to include only the cells that aren’t the #N/A error, so it averages the seven tracked nights.

That’s much better than typing 0 for the untracked nights. A 0 would count as a real night with no sleep and drag the average down to 5.1 hours.

And here is the formula to count the untracked nights:

=COUNTIF(B2:B11,"#N/A")
COUNTIF formula counting the three #N/A nights

This returns 3. The COUNTIF function can match the #N/A error when you put it in double quotes as the criteria.

Pro Tip: AVERAGEIF skips only #N/A, so a real error like #DIV/0! in the range still shows up in the result. To skip every error type, use the AGGREGATE function instead.

Example 4: Use NA() to Leave Gaps in a Line Chart

Now let’s use NA to fix a common chart problem.

Below is a student’s quiz log with the points scored out of 50 (Quiz 3 was missed, and Quizzes 8 to 10 haven’t happened yet), and I want the score percentage in column C so I can plot it in a line chart.

Quiz points out of 50 with Quiz 3 and Quizzes 8 to 10 missing and an empty score percentage column

A common way to handle the missing quizzes is to return empty text (“”), so let’s try that first. Here is the formula:

=IF(B2:B11="","",B2:B11/50)
IF formula returning empty text for the missing quizzes and the score percentage for the rest

The cells for the missing quizzes look empty. But here is what a line chart created from column C looks like:

Line chart of the empty-text scores dropping to 0% at Quiz 3 and Quizzes 8 to 10

The line drops to 0% at Quiz 3 and stays at 0% for Quizzes 8 to 10. A chart treats empty text from a formula as zero, so it looks like the student scored nothing on those quizzes.

Now here is the same calculation with NA() in column D:

=IF(B2:B11="",NA(),B2:B11/50)
IF and NA formula returning #N/A for the missing quizzes in column D

And here is the line chart created from column D:

Line chart of the NA scores leaving a gap at Quiz 3 and stopping after Quiz 7

This time, the line leaves a gap at Quiz 3 and stops after Quiz 7. Excel doesn’t plot the #N/A points at all, so the chart shows only the quizzes that actually happened.

Pro Tip: If you’d rather have the line connect across the missed quiz, right-click the chart, choose Select Data, click Hidden and Empty Cells, and uncheck “Show #N/A as an empty cell”. The quizzes after Quiz 7 still won’t be plotted.

If you are using Excel 2019 or earlier, enter the below formula in cell D2 and then copy it down the range:

=IF(B2="",NA(),B2/50)

Example 5: Highlight the Highest Point in a Chart Using NA

Here’s one more chart trick that uses NA.

Below is a movie theater’s ticket sales for each month, and I want to keep only the best month’s number in column C so I can highlight it in a line chart.

Movie theater tickets sold by month with an empty Highest column

Here is the formula:

=IF(B2:B13=MAX(B2:B13),B2:B13,NA())
IF, MAX and NA formula keeping only July's 3,140 and returning #N/A for every other month

The formula compares each month’s sales with the highest value in B2:B13. July has the highest sales (3,140), so it keeps that number, and every other month gets #N/A.

Now when you create a Line with Markers chart from A1:C13, the Highest column becomes a second series in the chart:

Line chart of tickets sold with a single highlighted, labeled marker on July

Since every other value in the Highest column is #N/A, that series has just one marker, right on July. I’ve made that marker bigger and added a data label, so July stands out.

To do the same, right-click the July marker and choose Add Data Labels. Then right-click it again, choose Format Data Series, and increase the Size under Fill & Line > Marker > Marker Options.

If two months tie for the highest sales, both keep their values, so both get highlighted.

If you are using Excel 2019 or earlier, enter the below formula in cell C2 and then copy it down the range:

=IF(B2=MAX($B$2:$B$13),B2,NA())

Pro Tip: To highlight the lowest month instead, change MAX to MIN in the formula.

So that’s how the NA function works. It gives you a deliberate #N/A, which keeps missing values from passing as zeros in your totals, averages, and charts.

When it’s time to deal with those #N/A values, the IFNA function can replace them with your own text, and the ISNA function can check whether a cell holds one.

I hope you found this Excel tutorial useful.

List of All Excel Functions

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.