Operator Precedence
You can use parenthese in your formulas to control the order in which the calculations occur. As an example, consider the following formula that uses references to named cells.
=Income-Expenses*TaxRate
The goal is to subtract expenses from income and then multiply the result by the tax rate. If you enter the above formula, you discover that excel computes the wrong answer. Rather, the formula multiplies expenses by the tax rate and then subtracts the result from the income. The correct way to write this formula is:
=(Income-Expenses)*TaxRate
To understand how this works, you need to be familiar with a concept called operator precedence - the set of rules that excel uses to perform is calculations. Table below shown lists excel's operators precedence. Operators with a lower precedence number are performed before operations with a higher precedence number.
Use parenthese to override excel's built-in order of precedence. Returning to the previous example, the formula without parentheses is evaluate using excel's standard operator precedence. Becuase multiplication has a higher precedence, the Expense cell multiplies by the TaxRate cell. Then, this result is subtracted from Income-Producing an incorrect calculation.
The correct formula uses parentheses to control the order of operations. Expressions within parentheses always get evaluated first. In this case, Expenses is subtracted from Income, and the result multiplies by TaxRate.
Operator Precedence in Excel Formulas
Symbol | Operator | Precedence |
- | Negation | 1 |
% | Percent | 2 |
^ | Exponentiations | 3 |
* and / | Multiplication and Division | 4 |
+ and - | Addition and Subtraction | 5 |
& | Text Concatenation | 6 |
=, <, >, <=, >=, and <> | Comparison | 7 |