N function

N(Value) N(Value)

Value

Number, Logical, Text, Color, { Number }, { Logical }, { Text } or { Color }

The value to convert.

Returns

Number or { Number }

The converted number.

Converts a value to a number. This function is primarily used to convert logical values to numbers (where TRUE is converted to 1 and FALSE is converted to 0). Text strings are converted to 0 and errors and numbers are returned unchanged. Colors are converted as though the TONUMBER function was used.

The -- operator is equivalent to this function, except for the fact that it does not accept text strings. The TONUMBER function is also equivalent, except for the fact that it tries to convert numeric text strings to numbers, while this function returns 0 when asked to convert a text string.

Examples

N(42)N(42)

Returns 42.

N("test")N("test")

Returns 0.

N("42")N("42")

Returns 0.

N(FALSE)N(FALSE)

Returns 0.

N(TRUE)N(TRUE)

Returns 1.