In a previous article, we learned how to create and input simple formulas in Excel. If you are already familiar with that, let’s move on to working with complex Excel formulas. By complex formulas, I mean one that has more than one mathematical operator, such as 2+3*56. The thing that you need to watch out for with complex formulas is the order of operations, which is the way in which Excel does its computations. If you construct the formula in the wrong order, you will get an incorrect result. Let’s see a few examples to understand how to use complex Excel formulas to do mathematical computations.
Importance of Order of Operators
Let’s take a simple example and find the result for the following in Excel:
=10 + 5 * 20 + 25 / 5 – The result in this case is 112
=(10 + 5) * 20 + 25 / 5 – The result in this case is 305
=10 + 5 *( 20 + 25) / 5 – The result in this case is 55
=(10 + 5 * 20 + 25) / 5 26.4 – The result in this case is 27
All these are formulas are valid but the placement of parentheses results in a different outcome in each case. Therefore it is essential that you take into account the order of operators when writing formulas.
Order of Operators for Complex Excel Formulas
Excel calculates formulas based on the following order of operations:
- Exponents (5^2, for example)
- Multiplication and division (whichever comes first in the formula)
- Addition and subtraction (whichever comes first in the formula)
A easier way to remember them is using their first characters PEMDAS.
Let’s learn how to do the math using the order of operators.
To find the resultant of : 20+(6-4)/2^3*4-2
Step 1: Compute P or Parentheses, which leads to: 20+(6-4)/2^3*4-2 or 20+(2)/2^*4-2
Step 2: Compute E or Exponents, which leads to: 20+2/2^3*4-2 or 20+2/8*4-2
Step 3: Compute M or D whichever comes first. In this case the division comes before multiplication, so we’ll do the Division computation first.
20+2/8*4-2 or 20+.25*4-2
Step 4: Compute M for Multiplication. 20+.25*4-2 or 20+1-2
Step 5: Compute A or S whichever comes first. In this case the addition comes before subtraction, so we’ll do the Addition computation first.
20+1-2 or 21-2
Step 6: Finally, lets do the subtraction to get the final result, which is 21-2 = 19
Creating Complex Formulas
If you input the formula =20+(6-4)/2^3*4-2 in the Formula Bar in Excel, you will instantly get the resultant as 19. Let’s look at another example. Let us calculate the sales tax on an invoice. The formula for this will be: =(D2+D3)*0.075
In cell D4, I will input this formula to compute my tax value, which equals 29.14875. What Excel has done in this case is added the values within the Parentheses ($139.90+$248.75)=388.65, then multiplied it by the tax rate which is 7.5% or (o.075), which is 388.65*0.075 = 29.14875
Instead of manually writing this value, you can of course use cell references to do all the computations. First, we’ll compute the total sales value of the pipes and screws, then we’ll compute the tax value.
1. Select the cell where you want to input the formula. In this case it is cell D2.
2. Enter the formula. Type =
3. Click cell B2
4. Enter the multiplication symbol *
5. Click cell C2.
6. Press Enter to find the total sales value of the pipes.
7. Now compute the value of the screws. Click inside cell D2 and drag the fill handle down to cell D3.
8. Now place the cursor in cell D4 to compute the tax value.
9. Type =
10. Click cell D2, enter the + sign and then click cell D3.
11. Next add a parenthesis around the current formula.
12. Next, add the multiplication symbol after the parenthesis and input the tax value, which is 0.075.
13. Press Enter.
You now have your tax computed and displayed in cell D4 as 29.14875
In the next post, we’ll learn more about Relative and Absolute Cell References.