Skip to content

Formats for Numeric Values

The following formats are supported in the second argument of the TO_NUMBER function.

Note: Any formats not listed here are not supported. You must use these formats as a template.

FormatExampleDescription
9999Each 9 represents the position of a digit. For example, a format of 999 expects up to three digits in a row. The function returns a result if the input string has 0, 1, 2, or 3 digits. Digits formatted as 9 are required only when they appear before a dot (.) and there is a leading 0. In all other cases, a 9 in the format does not have to map to a digit in the input string.

0000Each 0 also represents the position of a digit. However, 0 values must always map to a digit in the input string, and they cause 9 values that follow them to also behave as 0 values. For example, a format of 099 expects exactly three digits in a row. The 0 must map to a digit in the number string, and two additional digits must follow.

A format of 9990000 expects a minimum of four digits: the three 9 values are optional but the four 0 values are required. An input string with less than four digits results in an error.

. (period) or D999.99 or 999D99Location of the decimal point. You can specify only one period character in the format string.
, (comma) or G9G999D99 or 9,999D99Location of the thousands separator in a number. A format string cannot begin with a comma, and a comma cannot appear to the right of a decimal character or period.
PR9G999D99PRThe number string represents a negative value, as defined by the use of angle brackets (for example: <123.456>). PR must be the last element in the format string and cannot be used in combination with any other signs.
MI9G999D99MIPresence of a minus sign, for numbers less than 0. MI must be the last element in the format string. Only one sign element can be used in a format string.
S9G999D99SPresence of a sign anchored to the number, either + or -. S must be the first or last element in the format string. Only one sign element can be used in a format string.
V9G999V99This format divides the input values by 10^n, where n is the number of digits following V.V cannot be combined with a decimal point (for example, 99.9V99).

Parent topic:Formatting Functions