# How to use the NA function

**What is the NA function?**

The NA() function returns the error value #N/A meaning "value is not available". Use the NA() function to fill empty cells to avoid including empty cells in your calculations. Use the ISNA or IFNA function to identify #N/A errors.

## 1. Introduction

**What is the #N/A error value?**

The #N/A error occurs when a value is not available for a formula or found in a given cell range, for example in the VLOOKUP or MATCH functions.

The NA function lets you return the #N/A error in any formula you like, you can for instance use the IF function and a logical expression to determine when the error should occur.

**Related #N/A functions**

Excel Function | Description |
---|---|

NA() | Returns the #N/A error value |

IFNA(value, value_if_na) | Returns value_if_na if value is #N/A, otherwise returns value |

ISNA(value) | Returns TRUE if value is #N/A, FALSE otherwise |

ISERR(value) | Returns TRUE if value is any error except #N/A, otherwise FALSE |

ISERROR(value) | Returns TRUE if value is any error value, FALSE otherwise |

IFERROR(value, value_if_error) | Returns value_if_error if value is any error, otherwise returns value |

## 2. Syntax

NA()

The NA() function has no arguments.

## 3. Example 1

This example demonstrates the most basic way to use the NA function. The image above shows the NA function in cell B3, the formula in cell B3 is displayed in cell C3.

Formula in cell B3:

The output in cell B3 is an #N/A error which means "Not Avaliable". Some Excel functions return the #N/A error value if a particular value is not found like:

- VLOOKUP function
- MATCH function

## 4. Example 2

This example shows how to return the #N/A error if a VLOOKUP function returns an empty value. On the left (columns A and B):

- A list of office supplies (Text) with their corresponding prices (Price). Items include Binder, Paper, Pen, Eraser, Pencil, Note book, Scissor, Labels, Tape, and Envelopes
- Prices range from $1.70 to $7.50 and some cells are empty for example cells C5, C8, and C11.

Formula in cell F3:

The formula in cell F3 returns #N/A error because the lookup value in cell E3 "Tape" is found in column B, however the corresponding value in column C on the same row is empty.

This formula does the following:

- Attempts to look up the value in E3 (Tape) in the range B3:C12
- If the lookup returns an empty string, it returns NA() (Not Available)
- Otherwise, it returns the result of the VLOOKUP

This demonstrates how to use the NA() function in conjunction with VLOOKUP to handle missing data or items not found in the lookup range.

### Explaining formula in cell F3

#### Step 1 - Evaluate VLOOKUP

The VLOOKUP function lets you search the leftmost column for a value and return another value on the same row in a column you specify.

Function syntax: VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

VLOOKUP(E3,B3:C12,2,FALSE)

returns "", however, Excel shows 0 (zero) meaning the cell is empty.

#### Step 2 - Compare output to nothing ""

The equal sign is a logical operator that lets you compare values. This example shows how to check if the result of the VLOOKUP function is empty.

VLOOKUP(E3,B3:C12,2,FALSE)=""

becomes

""=""

and returns TRUE.

**What is a Boolean value?**

A Boolean value in Excel is a value that can only be TRUE or FALSE. It represents binary logic and is the result of a logical expression using logical operators or a result of a few Excel functions.

Mastering Boolean logic and logical expressions is key to manipulating data and controlling workflow in Excel.

#### Step 3 - Perform logic based on outcome

The IF function returns one value if the logical test is TRUE and another value if the logical test is FALSE.

Function syntax: IF(logical_test, [value_if_true], [value_if_false])

IF(VLOOKUP(E3,B3:C12,2,FALSE)="",NA(),VLOOKUP(E3,B3:C12,2,FALSE))

becomes

IF(TRUE,NA(),VLOOKUP(E3,B3:C12,2,FALSE))

and "#N/A" is returned.

## 5. Example 3

The image above shows an Excel spreadsheet with monthly price data in columns B and C, and corresponding line charts. The "Hidden and Empty Cell Settings" dialog box demonstrates different ways to handle empty cells and #N/A values in charts. The chart above shows gaps between data points.

Here is how to access the "Hidden and Empty Cell Settings" dialog box:

- Press with right mouse button on on the chart. A popup menu appears.
- Press with left mouse button on "Select Data...". A dialog box appears named "Select Data Source".
- Press with left mouse button on the "Hidden and Empty Cells" button located at the bottom left corner of the dialog box.

The "Hidden and Empty Cells" dialog box appears.

Press with left mouse button on the OK button to apply changes.

"Hidden and Empty Cells" dialog box has these settings in order to get the outcome shown in the image above:

- Show empty cells as: Gaps
- Check box "Show #N/A as an empty cell": Enabled
- Check box "Show data in hidden rows and columns": Disabled

Excel users can take advantage of the #N/A error and NA() function when working with charts in several ways:

**Controlling data visibility**: By using #N/A or the NA() function in cells where data is missing or shouldn't be plotted, users can control which points appear on the chart. This is useful for showing gaps in data or excluding certain periods from visualization.**Flexible chart appearance**: The "Hidden and Empty Cell Settings" dialog allows users to choose how #N/A values are displayed in charts:- As gaps (Image above): Creates breaks in the line chart where data is missing.
- As zero (Image 2): Plots #N/A values at zero, which can be misleading but sometimes desired. See the image below.
- Connected with lines (Image 3): Draws lines between known data points, ignoring #N/A values. See the last image below in this section.

**Data integrity**: Using #N/A or NA() clearly indicates missing data, unlike leaving cells blank or using zero which could be misinterpreted.**Dynamic charts**: When combined with formulas, #N/A can be used to create dynamic charts that show or hide data based on certain conditions.**Error handling**: In complex calculations, NA() can be used to propagate errors or unknown values through a series of formulas, affecting the chart only where truly necessary.

By understanding these options you can create more accurate charts that better represent their data including any gaps or uncertainties.

The image above shows a line chart in the bottom-right corner of the image where #N/A values are plotted at zero. "Hidden and Empty Cells" dialog box above the line chart demonstrates the settings that produce this outcome.

"Hidden and Empty Cells" dialog box has these settings:

- Show empty cells as: Zero
- Check box "Show #N/A as an empty cell": Enabled
- Check box "Show data in hidden rows and columns": Disabled

The image above shows a line chart in the bottom-right corner of the image where #N/A values are ignored and the remaining values are connected with a line. "Hidden and Empty Cells" dialog box above the line chart demonstrates the settings that produce this outcome.

"Hidden and Empty Cells" dialog box has these settings:

- Show empty cells as: Connect data points with line
- Check box "Show #N/A as an empty cell": Enabled
- Check box "Show data in hidden rows and columns": Disabled

## 6. How to enter the NA function in all empty cells at once?

Here is how to enter the NA() function in all empty cells in a given cell range. I am going to show you how to enter the NA() function in all empty cells in cell range C3:C8 in this example based on the image above:

- Select cell range C3:C12
- Press function key F5, a dialog box appears.
- Press with left mouse button on the "Special.." button, another dialog box appears.
- Press with left mouse button on "Blanks" to select it.
- Press with left mouse button on the "OK" button.

The image shows all empty cells selected.

- Press with left mouse button on in the "Formula bar".

- Type =NA()
- Press and hold the CTRL key.
- Press Enter once.
- Release the CTRL key.

The image above displays the final result, all empty cells are now populated with a #N/A error.

### 'NA' function examples

Table of Contents How to use the CHOOSECOLS function How to use the CHOOSEROWS function How to use the DROP […]

This article demonstrates a formula that allows you to search a data set using any number of conditions, however, one […]

### Functions in 'Information' category

The NA function function is one of 19 functions in the 'Information' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form