Examples

DECIMAL(4) : 0 (0.0)

DECIMAL(10 / 3) gives 3 (3.0). In AppSheet, a Number (10) divided by a Number (3) always produces a Number (3). In this example, the DECIMAL() function merely converts the Number result (3) to a Decimal value (3.0).

(10 / DECIMAL(3)) gives 3.33. In AppSheet, a Number (10) divided by a Decimal (3.0) always produces a Decimal (3.33). In this example, the DECIMAL() function converts a Number (3) to its Decimal equivalent (3.0).

(DECIMAL(10) / 3) gives 3.33. In AppSheet, a Decimal (10.0) divided by a Number (3) always produces a Decimal (3.33). In this example, the DECIMAL() function converts a Number (10) to its Decimal equivalent (10.0).

DECIMAL("4.2") gives 0 (0.0). AppSheet recognizes quoted raw text values in certain formats as Date, DateTime, or Time values. In this example "4.2" is recognized as the date, April 2 (of the current year). A Date value has no Decimal equivalent, so 0 (0.0) is returned. This (mis-)interpretation of the input only affects raw text values; an input from a column value or the result of another expression would not be so affected.

DECIMAL("14.2") gives 14.2. Unlike the preceding example, the quoted raw text value of "14.2" does not correspond to a valid Date, DateTime, or Time value, allowing DECIMAL() to work with the given text and to give the expected result.

DECIMAL("Hello!") gives 0, as the input value in no way resembles a numeric value.

DECIMAL("") gives a blank Decimal value.

Syntax

DECIMAL( any-value )

Argument

any-value (any)

Return Value

Decimal: The decimal equivalent of any-value if a recognizable number, or 0 if not. If any-value is blank (e.g., ""), the result will be a blank Decimal value.

See Also

APP(), DATE(), DATETIME(), NUMBER(), TEXT(), TIME()

Did this answer your question?