You are on page 1of 3

Order of precedence in calculations

Introduction
Formulas are mathematical expressions that calculate the value of cell contents. When cells
contain numerical data, you can perform multiple mathematical operations on the cell content as
you require. Formulas can be simple, such as adding two cell values, or quite complex, involving
multiple mathematical operations. When a calculation contains multiple operators, it is important
to control how Excel moves through them to ensure that they are processed in the correct order
for the required result.

By the end of this reading, you’ll be able to:

• Understand the impact of the Order of Precedence on Excel calculations.


• Create formulas that generate reliable results with the use of brackets.

Scenario
Aimee at Adventure Works needs to calculate the following formula: ((30+20)-(5*2))/2.

To do this, she needs to understand the Order of Precedence. Let’s explore how Excel calculates
a formula using the Order of Precedence and how a formula should be written to ensure that it
gives a reliable and correct result.

How Excel processes a formula


When Excel processes a formula, it does not always calculate expressions from left to right.
Instead, Excel assigns different levels of importance to different mathematical operators. This is
known as the Order of Precedence.

Excel uses eight basic mathematical operators. These are listed in order of importance in the
table below.

Name Symbol Example


Exponent ^ 10^2=100
Multiplication * 10*2=20
Division / 10/2=5
Addition + 10+2=12
Subtraction - 10-2=8
Equivalence = 10 = 10
Greater than > 10>2
If there are no other controls placed in the formula, then Excel will process mathematical symbols
in the order that they appear from top to bottom in the table. Multiplication and division have
equal precedence. If a formula contains only multiplication and division symbols, then Excel will
process the formula from left to right. The same is true for the addition and subtraction operators
and the greater than and less than symbols.

An easy way to remember the precedence order is to think of the word BEDMAS. This stands for
Brackets (Parentheses), Exponents, Division, Multiplication, Addition, and Subtraction and lists
the order in which the mathematical symbols are processed.
Let’s explore some examples.

The following formula is processed from left to right:

=A4+C10-D15

This is because the two mathematical symbols have the same status, so Excel simply applies
them in the order that they appear in the calculation.

However, the following formula would not be processed from left to right:

=B4-D10/H9

This is because the division symbol has a higher priority than the subtraction symbol in the table
shown. So, Excel first divides D10 by H9 and then subtracts.

However, you should also remember that BEDMAS can be canceled out by using correctly
placed brackets.

Using Brackets to Control a Calculation


Adding brackets to the calculation allows you to override the Order of Precedence and direct
Excel to process the formula in a specific order. Re-writing the previous example by including
brackets ensures that Excel processes the formula in the required sequence.

=(B4-D10)/H9

When the formula is written in this way, Excel subtracts D10 from B4 as the first step. It then
divides the result by the value in H9. In other words, the mathematical operation inside the
brackets was evaluated before the operation outside the brackets.

A formula can also contain sets of brackets within other brackets. If a calculation contains
brackets inside of brackets, then the expression within the inner set of brackets is processed first.
Excel then moves outside of the first set of brackets to process the rest of the calculation.

The following calculation:

=((30+20)-(5*2))/2

is processed as follows:

1. The two operations in the inner brackets are processed first.

Where there are two sets of brackets in a calculation, Excel will work through them left to right,
regardless of the symbols contained inside the brackets.

In this case, the addition in the first set of brackets is processed first because it is on the left,
giving an initial subtotal of 50.

=((30+20)-(5*2))/2

The multiplication in the second set of brackets is next because, of the two pairs of brackets, it is
the one on the right.
=((30+20)-(5*2))/2

This gives a second subtotal of 10.

1. Now that both innermost sets of brackets have been calculated, Excel moves out to the
next pair of brackets, which is a subtraction. At this level, Excel takes the first subtotal of
50 and subtracts the second subtotal of 10 to produce a third subtotal of 40.

=((30+20)-(5*2))/2

1. And finally, when all the elements inside the brackets have been calculated, the division
is processed. Excel takes the third subtotal of 40 and divides it by 2 to give a result of 20.

=((30+20)-(5*2))/2

Conclusion
In this reading, you’ve learned that it is important to know the Order of Precedence in
mathematical operators since Excel will use it by default to decide how to process a calculation.
You have also learned that brackets are used to control how Excel processes a calculation.

You might also like