DECIMAL()

Decimal from any value

Returns the `Decimal` equivalent of the value if it is a recognizable number, or 0 if not. If the value specified is blank (for example, `""`), the result will be a blank `Decimal` value.

Sample usage

`DECIMAL(4)` : `4`

`DECIMAL(10 / 3)` returns `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))` returns `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)` returns `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")` returns `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")` returns `14.2`. Unlike the preceding example, the quoted raw text value of `"14.2"` doesn't 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!")` returns `0` as the input value is not a numeric value.

`DECIMAL("")` returns a blank `Decimal` value.

Syntax

`DECIMAL(x)`

• `x` - Any value.

`DATE() `

`DATETIME()`

`NUMBER()`

`TEXT()`

`TIME()`