Difference between revisions of "Converting Numbers to Text"
(Number to Text) |
m |
||
Line 1: | Line 1: | ||
[[Category:Styles and options]] | [[Category:Styles and options]] | ||
− | + | There are two ways to convert a number or date to a text value: One is to use the [[NumberToText]] function. It lets you specify the format explicitly as a parameter. See [[NumberToText]] for details. The other, described here, uses the [[Text Concatenation Operator: &]] to concatenate the number with a text --- e.g., <code>"" & x</code>. | |
− | |||
− | |||
==Examples== | ==Examples== | ||
Line 11: | Line 9: | ||
:<code>"" & Exp(10) → '22.03K'</code> | :<code>"" & Exp(10) → '22.03K'</code> | ||
− | + | Text concatenation automatically converts ("coerces) any number to text. It uses the [[Number format]] set for the variable whose definition contains the expression. So, the result may vary depending on the Number format specified. To use a different number format for the coercion, you must set the number format for that object. When you set the number format while viewing a table for the variable, be sure you select the whole table, not just selected cells -- because cell-level formats don't affect the coercion to text. | |
== See Also == | == See Also == |
Latest revision as of 23:26, 18 July 2018
There are two ways to convert a number or date to a text value: One is to use the NumberToText function. It lets you specify the format explicitly as a parameter. See NumberToText for details. The other, described here, uses the Text Concatenation Operator: & to concatenate the number with a text --- e.g., "" & x
.
Examples
"" & (2^10) → '1024'
"" & Pi → '3.142'
"" & Exp(10) → '22.03K'
Text concatenation automatically converts ("coerces) any number to text. It uses the Number format set for the variable whose definition contains the expression. So, the result may vary depending on the Number format specified. To use a different number format for the coercion, you must set the number format for that object. When you set the number format while viewing a table for the variable, be sure you select the whole table, not just selected cells -- because cell-level formats don't affect the coercion to text.
Enable comment auto-refresher