Control the order of a calculation
Operators and percentages8 min
Builds on Your first formula.
A gift shop in Vermont sets its prices from cost, and the margin column shows what share of each price is profit. The formula has only three cell references in it, and one missing pair of parentheses turns a 37.5% margin into 4737.5%.
How it works
Excel works out a formula in a fixed order, the one from school math. Multiplication and division come before addition and subtraction, so =10- returns 8. Operators of the same rank go from left to right, so =12/ divides first and also returns 8.
Parentheses come before everything else: Excel works out what's inside them first, so =( returns 3. While you type, Excel gives each pair its own color, which makes it easier to check that every opening parenthesis has a closing one.
| Row | A | B | C |
|---|---|---|---|
| 1 | Order | Operator | Example |
| 2 | 1 | ( ) parentheses | =( |
| 3 | 2 | - as a sign | =-B2 |
| 4 | 3 | % percent | =B2* |
| 5 | 4 | ^ to the power of | =B2^ |
| 6 | 5 | * and / | =B2* |
| 7 | 6 | + and - | =B2+ |
| 8 | 7 | & join text | =A2& |
| 9 | 8 | =, <>, >, <, >=, <= compare | =B2>= |
Example
A desk organizer sells for $48.00, in B4, and costs the shop $30.00, in B5. The margin is the profit divided by the price.
=(B4-B5)/B4It returns 0.375, which the Percentage format shows as 37.5%.
| Step | =B4-B5/B4 | =(B4-B5)/B4 |
|---|---|---|
| 1 | B5/B4 is 0.625 | B4-B5 is 18 |
| 2 | B4-0.625 is 47.375 | 18/B4 is 0.375 |
| Shows | 4737.5% | 37.5% |
Common mistakes
=B4-divides first and shows 4737.5%. Put the subtraction in parentheses.B5/ B4 =E2+, meant as the average of two cells, halves only F2. Add first,F2/ 2 =(, or useE2+ F2)/ 2 =AVERAGE(.E2:F2) =H2/, meant to divide by H3 times 8, divides by H3 and then multiplies by 8. WriteH3* 8 =H2/.( H3* 8)
In short
- Excel works out parentheses first, then
*and/, then+and-. - Operators of the same rank go from left to right, so
=12/divides before it multiplies.3* 2 - Put parentheses around every part that has to be worked out first.
Practice
4 exercises · free, no account needed