Documentation/Calc Functions/N

From The Document Foundation Wiki
Jump to navigation Jump to search
Other languages:
English • ‎Nederlands



Function name:

N

Category:

Information

Summary:

Converts the supplied argument to a number.

Syntax:

N(Value)

Returns:

The number returned depends on the nature of the argument as follows:

  • For a numeric argument, N returns that number.
  • For a Boolean argument, N returns 1 (TRUE) or 0 (FALSE).
  • For a date/time argument, N returns the equivalent date-time serial number.
  • For a string argument, or a reference to an empty cell, N returns the value 0.
  • For an argument that represents an error condition, N propagates the error code.

Arguments:

Value is an expression, or a reference to a cell containing that expression, that is to be converted to a number.

Additional details:

None

Examples:

Formula Description Returns
=N(123.456) Here the argument is already a number and so the function returns that number. 123.456
=N(5%) Here the function converts the percentage to a fractional number. 0.05
=N(B1) where cell B1 contains the value 6.78E+03. Here the argument is already a number and so the function returns that number. 6780
=N(B2) where cell B2 contains the value 1 1/2. Here the argument is already a number and so the function returns that number. 1.5
=N(B3) where cell B3 contains the date 2022-02-01. Here the argument is a date and so the function returns its date-time serial number (assuming date references relative to the default start date of 1899-12-30). 44593
=N(B4) where cell B4 contains the value $23.45. Here the function converts the currency value to a number. 23.45
=N(C1) where cell C1 contains the logical value TRUE. Here the function converts the logical value to a number. 1
=N(C2) where cell C2 contains the logical value FALSE. Here the function converts the logical value to a number. 0
=N("LibreOffice") Here the argument is a string and so the function returns the value 0. 0
=N("58") Here the argument is a string and so the function returns the value 0. 0
=N(SQRT(-4)) Here the argument gives an invalid argument error (Err:502) and this is propagated by the N function. Err:502

Related LibreOffice functions:

T

VALUE

ODF standard:

Section 6.13.26, part 2

Equivalent Excel functions:

N