SpreadJS 13
SpreadJS Documentation / Formula Reference / Formula Overview / Operators in a Formula / Order of Precedence
In This Topic
    Order of Precedence
    In This Topic

    When there are several operators in a formula, the formula performs the operations in a specific order. The formula is parsed from left to right, according to a specific order for each operator or function in the formula. You can prioritize the order of operations by using parentheses in the formula.

    If you combine several operators in a single formula, the operations are performed in the order shown in the following table. Unary operations precede binary operations. If a formula contains operators with the same precedence, the operators are evaluated from left to right. To change the order of evaluation, enclose the part of the formula to be calculated first in parentheses; this has the highest precedence. Where the order of precedence is the same for two operators, the formula is evaluated from left to right.

    Order of Precedence from Highest to Lowest
    Operator Description
    left to right Direction
    ( ) Parentheses (for grouping)
    Negate
    + Plus
    % Percent
    ^ Exponent
    * and / Multiply and Divide
    + and - Add and Subtract
    & Concatenate
    =, <, >, <=, >=, <> Compare