New to expressions and formulas? Try Expressions: The Essentials
You can also learn more about other types of expressions.
Math Operators
The common numeric operators below may be used in math expressions.
Add
The plus character (+
) between two numeric values produces the result of adding them together. If both values are of the Number type, the result will be a Number; otherwise the result will be Decimal.
Examples:
2 + 2
[Count] + 1
[Price] + [Tax]
Divide
The slash character (/
) between two numeric values produces the result of dividing the left value by the right value. If both values are of the Number type, the result will be a Number; otherwise the result will be Decimal.
Examples:
4 / 2
([Day Count] / 7.0)
[Total] / [Unit Count]
Multiply
The asterisk character (*
) between two numeric values produces the result of multiplying them together. If both values are of the Number type, the result will be a Number; otherwise the result will be Decimal.
Examples:
(10.0 * 10)
[Week Count] * 7
[Unit Cost] * [Unit Price]
Negate
The minus character (-
) preceding a single numeric value produces the arithmetic negation of the value: a positive value becomes negative, a negative value becomes positive. The type of the result will match that of the original value.
Examples:
-18.56
-[Unit Count]
-([Seat Count] * [Gift Value])
Subtract
The minus character (-
) between two numeric values produces the result of subtracting the right value from the left value. If both values are of the Number type, the result will be a Number; otherwise the result will be Decimal.
Examples:
124.0 - 18.9
(14.0 - [Vacation Days Used])
[Price] - [Discount]
Math Functions
Math functions may also be used anywhere math expressions may be used.
- ABS(): Absolute value
- AVERAGE(): Average of list of values
- CEILING(): Nearest higher Number
- FLOOR(): Nearest lower Number
- LN(): Natural log
- LOG(): Logarithm
- LOG2(): Log base 2
- LOG10(): Log base 10
- MOD(): Remainder from Number division
- POWER(): Exponentiation
- RANDBETWEEN(): Random Number
- ROUND(): Nearest Number
- SQRT(): Square root
- STDEVP(): Standard deviation of list of values
- SUM(): Sum of list of values
Numeric Types
AppSheet understands two basic numeric data types:
Decimal: numbers that include a decimal point separating a whole number component from a fractional component. For example: -0.03, 0.0, 3.14159, 14.99. Also known as a real number or floating-point number. The number of digits displayed after the decimal point (2 by default) can be changed in a Decimal column's configuration. The display format is also affected by the app user's locale.
Number: numbers that do not include a decimal point. For example: -29, -5, 0, 732, 4096. Also known as integers or whole numbers.
Several other data types are based on the above:
Percent is a Decimal with special display characteristics. For example, a Percent value of 0.0 is displayed as 0%; 0.05 is displayed as 5%; 0.2 as 20%; and 1.0 as 100%.
Price is a Decimal with special display characteristics. For example, a Price value of 0.0 is displayed as $0.00; 5.2 is displayed as $5.20; 67.482 as $67.48; and 100.0 as $100.00. The currency symbol ($ by default) can be changed in a Price column's configuration.