numberFormat
Formats a number using the specified format pattern and locale.
Use currencyFormat to apply currency formatting.
Parameters
VALUE (number)
The number to format.
FORMAT (string)
Optional. The format pattern. You can enter your own pattern or select from the parameter dropdown in the Function Builder. See Syntax for number format patterns for guidance.
Default: #,##0.##
LOCALE (string)
Optional. Determines which characters to use for decimal and thousand separators in the output expression. All supported locales are included in the parameter dropdown in the Function Builder.
Default: en_US
Important
The default values above are the system defaults. You can change these defaults in your project's Settings view. See Settings > Number and Currency for guidance.
Examples
Assume the settings in Settings > Number and Currency are:
Setting | Value |
---|---|
LOCALE |
|
NUMBER FORMAT |
|
Tip
We explain how number format patterns are made up in Syntax for number format patterns.
ATL in Script | Result | Notes |
---|---|---|
| 50 | The optional parameters are unspecified, so the project settings for FORMAT and LOCALE apply. |
| 50.0 | The format pattern ensures the number is displayed to one decimal place with trailing zeros retained. The project setting for LOCALE applies by default. |
| 123.40 | The format pattern ensures the number is displayed to two decimal places with trailing zeros retained. The project setting for LOCALE applies by default. |
| 123.4 | The format pattern ensures the number is displayed to two decimal places with trailing zeros stripped. The project setting for LOCALE applies by default. |
| 123.401 | The format pattern ensures the number is displayed to four decimal places with trailing zeros stripped. The project setting for LOCALE applies by default. |
| 1,234.57 | The optional parameters are unspecified, so the project settings for FORMAT and LOCALE apply. As per that locale, a comma is used for the thousands separator and a period is used for the decimal separator. |
| 1234.57 | The format pattern does not include a thousands separator and this is reflected in the result. The project setting for LOCALE applies by default. As per that locale, a period is used for the decimal separator. |
| 1.234,5678 | The format pattern ensures the number is displayed to four decimal places. The locale is es_ES (Spanish, Spain), so a period is used for the thousands separator and a comma is used for the decimal separator. |
| 1'234.568 | The format pattern ensures the number is displayed to three decimal places. The locale is fr_CH (French, Switzerland), so an apostrophe is used for the thousands separator and a period is used for the decimal separator. |
Positive and negative subpatterns
These examples use a format string that includes both a positive and negative subpattern:
ATL in Script | Result |
---|---|
| 1,234.57 |
| (1,234.57) |
| (-1,234.57) |
Tip
We explain the syntax for subpatterns in Positive and negative subpatterns.