TEXT Function: Difference between revisions
From Planfix
(Created page with "== Go To == * Standard operators and Planfix functions *Calculated fields *Reports") |
No edit summary |
||
Line 1: | Line 1: | ||
The TEXT function formats numbers according to a given format. For example, if column A contains the number 23.7825 and you need to format it to three decimal places, you would use | |||
TEXT(A;".3f") | |||
As a result, you'd get the string "23.782". | |||
''Format:'' | |||
TEXT(number;string_format) | |||
String format: | |||
The string format is written as follows: [flags][width][.precision]conversion | |||
*[flags] — special symbols for formatting. For example, the "+" flag means that the numeric value must include the + symbol; the "-" flag means the result should be left-justified; and the "," flag sets the thousands separator for integers. It is not mandatory. | |||
*[width] — A positive decimal integer that defines the minimum number of characters to be displayed. It is not mandatory. | |||
*[.precision] — non-negative integer with a decimal point before it. Usually used to limit the number of characters. It is not mandatory. | |||
*conversion — a symbol that indicates how the number should be formatted. You can use d for whole numbers, f for floats. This is mandatory. | |||
As an example, let's say we have the number 12.34 in a field called "Number field." | |||
*TEXT({{Task.Number field}};"d") - result: 12 | |||
*TEXT({{Task.Number field}};"05d") - result: 00012 | |||
*TEXT({{Task.Number Field}};"04.3f") - result: 0012.340 | |||
*TEXT({{Task.Number field}};".4f") - result: 12.3400 | |||
Examples: | |||
TEXT(A;".3f") | |||
TEXT({{Task.Number field}};".3f") | |||
TEXT(1234567; ",.2f") - result: 12 345,67 | |||
== Go To == | == Go To == | ||
*[[Standard functions | Standard operators and Planfix functions]] | *[[Standard functions | Standard operators and Planfix functions]] | ||
*[[Calculated fields]] | *[[Calculated fields]] | ||
*[[Reports]] | *[[Reports]] |
Revision as of 05:55, 11 December 2019
The TEXT function formats numbers according to a given format. For example, if column A contains the number 23.7825 and you need to format it to three decimal places, you would use
TEXT(A;".3f")
As a result, you'd get the string "23.782".
Format:
TEXT(number;string_format)
String format:
The string format is written as follows: [flags][width][.precision]conversion
- [flags] — special symbols for formatting. For example, the "+" flag means that the numeric value must include the + symbol; the "-" flag means the result should be left-justified; and the "," flag sets the thousands separator for integers. It is not mandatory.
- [width] — A positive decimal integer that defines the minimum number of characters to be displayed. It is not mandatory.
- [.precision] — non-negative integer with a decimal point before it. Usually used to limit the number of characters. It is not mandatory.
- conversion — a symbol that indicates how the number should be formatted. You can use d for whole numbers, f for floats. This is mandatory.
As an example, let's say we have the number 12.34 in a field called "Number field."
- TEXT(Template:Task.Number field;"d") - result: 12
- TEXT(Template:Task.Number field;"05d") - result: 00012
- TEXT(Template:Task.Number Field;"04.3f") - result: 0012.340
- TEXT(Template:Task.Number field;".4f") - result: 12.3400
Examples:
TEXT(A;".3f")
TEXT(Template:Task.Number field;".3f")
TEXT(1234567; ",.2f") - result: 12 345,67