Spread.NET 15 Formula Reference
Formula Overview / Operators in a Formula
In This Topic
    Operators in a Formula
    In This Topic

    The following table lists the available operators. For each operator, an example is given of the syntax of using a literal value as well as a cell reference. The type of value returned is given for each type of operator.

    Type of Operator Example Syntax Result
    Operator Description Literal & Literal Cell Ref & Literal Type Returned
    Binary Operators
    + Add 5 + 3 A1 + 3 double
    Subtract 5 – 3 A1 – 3 double
    * Multiply 5 * 3 A1 * 3 double
    / Divide 5 / 3 A1 / 3 double
    ^ Exponent 5 ^ 3 A1 ^ 3 double
    & Concatenate "F" & "p" A1 & "p" string
    = Equal   A1 <> 3 boolean
    < > Not Equal   A1 = 3 boolean
    < Less Than   A1 <3 boolean
    > Greater Than   A1 > 3 boolean
    <= Less Than Or Equal   A1 <= 3 boolean
    >= Greater Than Or Equal   A1 >= 3 boolean
    Unary Operators
    - Negate -(5/3) -(A1/3) double
    + Plus +(5/3) +(A1/3) double
    % Percent (5/3)% (A1/3)% double

    Operators specify the type of calculation that you want to perform on the elements of a formula. Most of the operators return double-precision floating point values for mathematical operations and boolean (or logical) values for comparison operators.

    In Spread, all arithmetic operators (including the unary +) check their arguments and return a #VALUE error if any of the arguments are strings that can not be converted to a number. This is mathematically correct behavior and can not be overridden. For example, the three formulas +B5 and 0+B5 and --B5 should all produce the same result and, in Spread, they do.

    Because more than one operator may be used in a formula, so be sure you understand the Order of Precedence.

    The mathematical operators and unary operators may also be used with date-time and time-span values, as summarized in Using Operators with Dates and Times.

    Return to the Formula Overview.