Difference between revisions of "Documentation/How Tos/Calc: N function"
From Apache OpenOffice Wiki
< Documentation | How Tos
m |
(ODFF issues) |
||
Line 8: | Line 8: | ||
<tt>'''N(value)'''</tt> | <tt>'''N(value)'''</tt> | ||
− | : | + | : returns the numeric value of <tt>'''value'''</tt> if possible. It returns the logical values <tt>'''TRUE'''</tt> and <tt>'''FALSE'''</tt> as <tt>'''1'''</tt> and <tt>'''0'''</tt> respectively. |
+ | |||
+ | : <tt>'''N()'''</tt> is not intended to convert text to a number - use the <tt>'''VALUE()'''</tt> function instead. | ||
Line 20: | Line 22: | ||
<tt>'''N(A3)'''</tt> | <tt>'''N(A3)'''</tt> | ||
: where A3 contains <tt>'''FALSE'''</tt>, returns <tt>'''0'''</tt>. | : where A3 contains <tt>'''FALSE'''</tt>, returns <tt>'''0'''</tt>. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== See also: === | === See also: === | ||
− | '''[[Documentation/How_Tos/Calc: ISNUMBER function|ISNUMBER function]]''', | + | '''[[Documentation/How_Tos/Calc: ISNUMBER function|ISNUMBER]]''', |
− | '''[[Documentation/How_Tos/Calc: T function|T | + | '''[[Documentation/How_Tos/Calc: VALUE function|VALUE]]''', |
− | '''[[Documentation/How_Tos/Calc: TEXT function|TEXT | + | '''[[Documentation/How_Tos/Calc: T function|T]]''', |
− | '''[[Documentation/How_Tos/Calc: FIXED function|FIXED | + | '''[[Documentation/How_Tos/Calc: TEXT function|TEXT]]''', |
− | '''[[Documentation/How_Tos/Calc: DECIMAL function|DECIMAL | + | '''[[Documentation/How_Tos/Calc: FIXED function|FIXED]]''', |
+ | '''[[Documentation/How_Tos/Calc: DECIMAL function|DECIMAL]]''' | ||
'''[[Documentation/How_Tos/Calc: Information functions|Information functions]]''' | '''[[Documentation/How_Tos/Calc: Information functions|Information functions]]''' | ||
+ | |||
+ | |||
+ | ===Issues: === | ||
+ | <tt>'''N()'''</tt> in Calc will convert text to a number, but in Excel it will not. The ODFF standard deliberately does not specify a behaviour. Use <tt>'''VALUE()'''</tt> to convert from text to number. |
Revision as of 13:42, 9 December 2007
N
Returns the numeric value.
Syntax:
N(value)
- returns the numeric value of value if possible. It returns the logical values TRUE and FALSE as 1 and 0 respectively.
- N() is not intended to convert text to a number - use the VALUE() function instead.
Example:
N(123)
- returns 123, because 123 is (already) a number.
N(TRUE)
- returns 1.
N(A3)
- where A3 contains FALSE, returns 0.
See also:
ISNUMBER, VALUE, T, TEXT, FIXED, DECIMAL
Issues:
N() in Calc will convert text to a number, but in Excel it will not. The ODFF standard deliberately does not specify a behaviour. Use VALUE() to convert from text to number.