Operators are symbols that “operate” on one or two terms in an expression to form a result. A term is a single variable, identifier, function, or constant, or an expression enclosed in parentheses. Each term is evaluated separately and results in a value.
Here are the five mathematical operators:
+ (plus sign) Adds the value of the term preceding it to that of the term following it.
– (minus sign) Subtracts the value of the term following it from that of the term preceding it. If no term precedes the minus sign, it reverses the sign of the value of the term following it.
* (asterisk) Multiplies the value of the term preceding it by that of the term following it.
/ (slash) Divides the value of the term preceding it by that of the term following it.
% (percent sign) Divides the value of the term preceding it by 100.
The entire expression is evaluated from left to right, regardless of what type of operator is used. The only exception to this is if a part of an expression is enclosed in parentheses (), which makes that part a separate term. In this case, the part enclosed in parentheses is evaluated before the rest of the expression. Parentheses can be nested (()), in which case the part in the innermost set of parentheses is evaluated first, then the part in the outer set of parentheses, and finally the portion outside parentheses.
You must subscribe to a Sage Business Care plan to access payroll formulas within Sage 50.
Here are a few examples:
A = 5 + 4 * 3 – 2 * 6
results in A being set to 150, since the operators are evaluated left to right.
A = 5 + (4 * 3) – (2 * 6)
results in A being set to 5, since the expressions within parentheses are evaluated first.
A = 5 + (4 * (3 – 2) * 6)
results in A being set to 29, since the expression in the innermost parentheses is evaluated first, then the expression in the outer set of parentheses, and finally any outside parentheses.
Besides mathematical operators, there are relational operators, which can be used only in an IF function. A relational operator compares, in some way, one term with another term. The result of a relational expression is either TRUE or FALSE. The relational operators are as follows:
= (equal sign) If the two terms have the same value, the result is TRUE; otherwise the result is FALSE.
< (left angle bracket) If the first term has a value that is less than the value of the second term, the result is TRUE; otherwise the result is FALSE.
> (right angle bracket) If the first term has a value that is greater than the value of the second term, the result is TRUE; otherwise the result is FALSE.
<= If the first term has a value that is less than or equal to the value of the second term, the result is TRUE; otherwise the result is FALSE.
>= If the first term has a value that is greater than or equal to the value of the second term, the result is TRUE; otherwise the result is FALSE.
<> If the two terms have different values, the result is TRUE; otherwise the result is FALSE.