Introduction
You may have experience working with formulas that contain only one operator, such as 7+9. More complex formulas can contain several mathematical operators, such as 5+2*8. When there's more than one operation in a formula, the order of operations tells Excel which operation to calculate first. To write formulas that will give you the correct answer, you'll need to understand the order of operations.
Optional: Download our practice workbook.
Watch the video below to learn more about complex formulas.
The order of operations
Excel calculates formulas based on the following order of operations:- Operations enclosed in parentheses
- Exponential calculations (3^2, for example)
- Multiplication and division, whichever comes first
- Addition and subtraction, whichever comes first
A mnemonic that can help you remember the order is PEMDAS, or Please Excuse My Dear Aunt Sally.
Click the arrows in the slideshow below to learn how the order of operations is used to calculate formulas in Excel.
Creating complex formulas
In the example below, we'll demonstrate how Excel uses the order of operations to solve a more complex formula. Here, we want to calculate the cost of sales tax for a catering invoice. To do this, we'll write our formula as =(D3+D4+D5)*0.075 in cell D6. This formula will add the prices of our items, then multiply that value by the 7.5% tax rate (which is written as 0.075) to calculate the answer.
It's
especially important to follow the order of operations when creating a
formula. Otherwise, Excel won't calculate the results accurately. In our
example, if the parentheses are not included, the
multiplication is calculated first and the result is incorrect.
Parentheses are often the best way to define which calculations will be
performed first in Excel.
To create a complex formula using the order of operations:
In the example below, we'll use cell references along with numerical values to create a complex formula that will calculate the subtotal for a catering invoice. The formula will calculate the cost of each menu item first, then add these values.- Select the cell that will contain the formula. In our example, we'll select cell C5.
- Enter your formula. In our example, we'll type =B3*C3+B4*C4. This formula will follow the order of operations, first performing the multiplication: 2.79*35 = 97.65 and 2.29*20 = 45.80. It then will add these values to calculate the total: 97.65+45.80.
- Double-check your formula for accuracy, then press Enter on your keyboard. The formula will calculate and display the result. In our example, the result shows that the subtotal for the order is $143.45.
You can add parentheses to
any equation to make it easier to read. While it won't change the
result of the formula in this example, we could enclose the
multiplication operations within parentheses to clarify that they will
be calculated before the addition.
Excel will not always tell you if your formula contains an error, so it's up to you to check all of your formulas. To learn how to do this, you can read the Double-Check Your Formulas lesson from our Excel Formulas tutorial.