3.5.7.30 NumberValueNumberValue-func
Description
The NumberValue() function is similar to MS Excel's NUMBERVALUE function and is used to convert a string to a number. There are options for specifying decimal and numeric group separators when interpreting the string, thus allowing you to override OS regional settings.
The function can be used to return a single value (e.g. numbervalue("4,227", ",")=; ) in which case the string should be enclosed in quotes; or it can take a vector of strings, in which case you do not need to enclose the vector in quotes (e.g. numbervalue(col(A), ",") ).
Syntax
double NumberValue( string str$ [, string Decimal$, string Group$] )
Parameters
str
- string or vector of strings and converts to numeric.
Decimal
- optional decimal separator to be used in interpreting how the string is to be converted.
Group
- optional group separator (thousands, etc.) to be used in interpreting how the string is to be converted.
Return
Returns a numeric value or a vector of numeric values.
Examples
numbervalue("1,000.05")=; // returns 1000.05 (US regional settings)
round(numbervalue("1,000.05"),1)=; // returns 1000.1 (US regional settings)
numbervalue("5.000,0", ",", ".")=; // returns 5000 (US regional settings)
numbervalue(col(A))=; // returns a vector of numbers using regional settings to interpret format
See Also
Value, Text/Format, Round, Prec
|