Order of operations in a formula
MySpreadsheet calculates formulas based on the following order of operations:
- Operations enclosed in parentheses are performed first:
- The order of operations depends on their priority.
- Operations in the nested parentheses are performed first.
tip
If a formula contains the parentheses that are not essential in the calculation, they will be deleted automatically. For example, the formula =SUM(1+(2*5)+1) will be automatically transformed into =SUM(1+2*5+1).
- Operations outside the parentheses are performed according to their precedence.
- Operations with the same precedence are performed from left to right, with the exception of the exponentiation (^), which is performed from right to left. Example: = 2^4^2 = 2^16 = 65,536.
If you combine several operators in a single formula, MySpreadsheet performs the operations in the order shown in the following table below.
| Priority | Operator symbol | Operator description |
|---|---|---|
| 1 | : | Range |
| 2 | Space | |
| 3 | % | Percentage |
| 4 | + - | Unary plus Unary minus Unary space |
| 5 | ^ | Exponentiation |
| 6 | * / | Multiplication Division |
| 7 | + - | Addition Subtraction |
| 8 | & | Combining two text strings into one |
| 9 | = > < >= <= <> | Comparison: Equal to Greater than Less than Greater than or equal to Less than or equal to Not equal to |