New to expressions and formulas? Try Expressions: The Essentials

You can also learn more about other types of expressions.

Math Conditions

Math Expressions use arithmetic operators to return a numeric value. All operators, except Unary Minus, are used with two numeric expression parameters, e.g. (3+2), (5.0/2.3), etc. AppSheet conditions aren't a one-to-one match with Google Sheets functions. However, in some cases the formatting similarity may help construct your expressions. Alternatively, if the formatting isn't similar, the Google Sheets function page may provide context for use of the function. If available, see the Google Sheets function link in parentheses next to applicable operators.

Math Operators

Use any of the arithmetic operators below to build arithmetic expressions:

Math Functions

Use any of the arithmetic functions below to build arithmetic expressions:

  • Mod(numberX, numberY): returns a number that is the remainder when numberX is divided by numberY (MOD)
  • Round(decimalX): returns a number that rounds the decimal up or down to the closest integer number (ROUND)
  • Ceiling(decimalX): returns a number that rounds the decimal up to the closest larger integer number (CEILING)
  • Floor(decimalX): returns a number that rounds the decimal down to the closest smaller integer number (FLOOR)
  • Abs(numericX): returns the absolute value of a number (ABS)
  • Power(numericX, numericY): returns a decimal that raises numericX to the power of numericY (POWER). For example: Power(4, 2) = 16; Power(16, 0.5) = 4.
  • RandBetween(numberLow, numberHigh): returns a random number in the range between numberLow to numberHigh (RANDBETWEEN)
  • Sqrt(decimalX): returns the square root of decimalX

Common and Complex Expressions

Common Expressions

  • (1+[Number])
  • ([Decimal]-4.5)
  • ([Price]*[Quantity])
  • 10/2

Complex Expressions

  • ([Number]*2) + ([Number]*3)
  • ([Number]*Mod(5, 3)) + ([Number]*Ceiling(2.7))

Math Expression Patterns and Examples

From the Expression Builder, follow the pattern below for a numeric result. See examples for further clarity.

Pattern                                                           Example

({value_1} + {value_2})                                   ([Decimal] + 1.12)

({value_1} - {value_2})                                    ([Percent] - 0.2)

({value_1} * {value_2})                                    ([Price] * 19.99)

({value_1} / {value_2})                                    ([Number] / 1)

({value_1} % {value_2})                                  ([Percent] % 0.2)

(- {value_1})                                                     (- [Decimal])

Expressions in this article align with the Math Expressions in the Expression Builder in the Editor. Expressions may be used in various AppSheet features--Initial Values, App Formulas, Virtual Columns and Column Constraints (Valid_If, Show_If, Required_If)--to customize app behavior and provide your users with advanced functionality.

Did this answer your question?