Returns a value converted to a number.
Syntax
N(value)
Value is the value you want converted. N converts values listed in the following table.
If value is or refers to | N returns |
---|---|
A number | That number |
A date, in one of the built-in date formats available in the spreadsheet | The serial number of that date |
TRUE | 1 |
FALSE | 0 |
An error value, such as #DIV/0! | The error value |
Anything else | 0 |
- It is not generally necessary to use the N function in a formula, because values are automatically converted as necessary. This function is provided for compatibility with other spreadsheet programs.
- Dates are stored as sequential serial numbers so they can be used in calculations. By default, December 31, 1899 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900.
Example
The example may be easier to understand if you copy it to a blank spreadsheet.
- Create a blank spreadsheet.
- Select the example in the Help topic.
Selecting an example from Help
- Press CTRL+C.
- In the spreadsheet, select cell A1, and press CTRL+V.
- To switch between viewing the formula that returns the result and the result in the cell, select the cell and press F2 and then ENTER, or click Commands and Options on the spreadsheet toolbar, click the Formula tab, and look in the Formula in active cell (active cell) box.
Data | |
---|---|
7 | |
Even | |
TRUE | |
4/17/2008 | |
Formula | Description (Result) |
=N(A2) | Because A2 contains a number, it is returned (7) |
=N(A3) | Because A3 contains text, 0 is returned (0, see above) |
=N(A4) | Because A4 is the logical value TRUE, 1 is returned (1, see above) |
=N(A5) | Because A5 is a date, the serial number is returned (varies with the date system used) |
=N("7") | Because "7" is text, 0 is returned (0, see above) |