Yesterday, in the 30XL30D challenge, we identified cell contents with the TYPE function, and used it to check for a number, before multiplying.
For day 22 in the challenge, we'll examine the N function. It's similar to the T function that we saw earlier, but checks for numbers instead of text.
NOTE: You can have all of the 30 Functions content in an easy-to-use single reference file -- the 30 Excel Functions in 30 Days eBook Kit ($10).
So, let's take a look at the N information and examples, and if you have other tips or examples, please share them in the comments.
Function 22: N
The N function returns a value converted to a number.
How Could You Use N?
The N function has limited use, and can usually be replaced by a different function or operator. You can:
- Return number based on a cell's value
- Use N function alternatives
- Add a hidden note in a cell
The N function has the following syntax:
- value can be text, number, or any other value
If the value is an error, the N function returns the same error, instead of a number. Use IFERROR or ISNUMBER to handle the errors.
Example 1: Return a Number Based on Cell Value
With the N function, you can return a number, based on a cell's value. If the value is a number, then that number is returned.
This table shows the result of other values in the N function.
Example 2: N Function Alternatives
Instead of the N function, you can use ISNUMBER to test for numbers.
Or use two minus signs (double unary) to convert TRUE/FALSE or text numbers to numbers.
Example 3: Add Hidden Note to Cell
If you want to add a hidden note in a cell, you can use the N function. Because the result of a text value in the N function is zero, adding this note won't affect the cell result.
The note will only be visible in the formula bar, when the cell is selected.
=SUM(B3:C3) + N("Store01 closed in June")
Download the N Function File
To see the formulas used in today's examples, you can download the N function sample workbook. The file is zipped, and is in Excel 2007 file format.
Watch the N Video
To see a demonstration of the examples in the N function sample workbook, you can watch this short Excel video tutorial.
YouTube link: Return Cell Value as Number with Excel N Function