Operator Precedence in QuickBase Formulas

Operators play an important role in the QuickBase formula language. Operators are special symbols like + and * that act upon one or two values to return a new value. They tell QuickBase what you want to do with the values in your formula. There are two types of operators:

Rules of Operator Precedence

QuickBase doesn't evaluate a formula in a random order. It doesn't even evaluate a formula from left to right, as many people imagine. Instead, operators have a predefined order of precedence. In other words, QuickBase acts on certain operators before it acts upon others. For example, * has higher precedence than +. This means that the expression 3+4*2 evaluates to 11, not 14.

Tip: To manually control operator precedence, enclose portions of your formula in parentheses. QuickBase always evaluates operators within parentheses first and treats the result as a single value before moving on to the rest of the formula. (Read more in Writing a formula section of the Using Formulas topic.)

In the following table, operators are listed from highest precedence to lowest precedence.

Precedence LevelOperatorEvaluation Order in Expressions
1 (highest)unary +, unary -, notRight to left
2^Left to right
3*, /Left to right
4binary +, binary -, &Left to right
5<, >, <=, >=Left to right
6=, <>Left to right
7andLeft to right
8 (lowest)orLeft to right

When binary operators of the same precedence appear next to each other, they are evaluated left to right. When unary operators appear next to each other they are evaluated right to left.

For example, the following expressions are equivalent, and they return the Boolean value true.

3 < 2 + 1 / 5 + --3 and 8 > 3

(3 < ((2 + (1 / 5)) + (-(-3)))) and (8 > 3)

Related Topics:


Return to top   

© 1999-2016  QuickBase, Inc.  All rights reserved.  Legal Notices.