Description
Use this function to return a number when given a value.
This function is typically used to convert TRUE and FALSE to 1 and 0 respectively. Refer to the value conversion table for other uses.
Syntax
N(value)
Inputs
This function has the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
value |
Yes | The value to be evaluated. | A cell reference, a number, a date, a text string, an error, or a formula which results in any of these. |
Values are converted as shown here:
| Supplied value | Returned value |
|---|---|
| Any number | Same number. The sign (positive or negative) is retained. |
| A date in the format yyyy/mm/dd | A date in serial number format |
| A date in any other format. | A number calculated by treating the date as an equation. If the date is in quotation marks, then the #VALUE! error is returned |
| TRUE | 1 |
| FALSE | 0 |
| Error (#VALUE, #N/A, #NUM!, etc.) | Same error code |
| Other values (Including text in quotation marks) | 0 |
| Text in not in quotation marks | #NAME? error |
Examples
Sample data
| A | B | |
|---|---|---|
| 1 | red | TRUE |
| 2 | 12/06/2024 | FALSE |
| 3 | 12 | 15 |
| 4 | #VALUE! | 23465 |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Convert a text value to a number. | =N("red") |
The N function converts a value to a number. When the value is text, the function returns 0. |
| Convert the contents of a cell containing text to a number. | =N(A1) |
This formula converts the value in cell A1 to a number. Since A1 contains the text "red," the function returns 0. |
| Convert a date in a cell to its corresponding serial number. | =N(A2) |
The N function recognizes dates and converts them to their underlying serial numbers. The serial number for the date in cell A2, "12/06/2024," is 45632. |
| Convert a logical value to a number. | =N(B1) |
This formula converts the logical value TRUE found in cell B1 to its numeric equivalent, which is 1. |
| Convert a logical value to a number. | =N(B2) |
This formula converts the logical value FALSE found in cell B2 to its numeric equivalent, which is 0. |
| Convert a mathematical operation's result to a number. | =N(A3+B3) |
The N function takes the result of the calculation A3+B3, which is 12 + 15, and returns that number. The result is 27. |
| Convert an error value to a number. | =N(A4) |
The N function cannot convert an error value like #VALUE! into a number. Therefore, it returns the error itself, which is #VALUE!. |
Notes
- Wildcards don't work with this function.
Related functions
ABS
EXP
LN
MOD
POWER
PRODUCT
SIGN
SQRT
SUBTOTAL
SUM
SUMIF
SUMIFS
SUMPRODUCT