Order of calculation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anybody know of a good website which has examples of the way in which
Excel performs calculations when there is more than one operator in the
calculation? I understand the brackets go around the 'easy' bit, in order to
tell Excel to do that bit first, but if the calculation has more than 2
operators, I don't know where the other sets of brackets go.

Any help would be appreciated.
Thank you.

Louise
 
BODMAS

Brackets
Of
Divide
Multiply
Add
Subtract

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
hello, thank you for your reply.
Unfortunately, this doesn't really help me. I am already aware of the
actual order, what I am unsure of is where the different sets of brackets go
when the calculation contains more than two operators.

Louise
 
That depends upon what order you want them to be processed.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
A basic example........

My calculation is =10+10*2+2*10

My total should therefore be 420.

Where do the brackets go, and why, in order to get to the right answer???

Louise
 
Louise said:
"Bob Phillips" wrote:
A basic example........

My calculation is =10+10*2+2*10

My total should therefore be 420.

Where do the brackets go, and why, in order to get to the right answer???

It looks as if you want
=((10+10)*2+2)*10

It sounds as if, to get what *you* have defined as the right answer, you
want each operation in the order in which they are listed, rather than in
the order of precedence which Bob gave you.
To be on the safe side, you could, if you wish, put brackets round each
operation in turn:
=(((10+10)*2)+2)*10

.... but you can omit the brackets where the conventional order of precedence
doesn't need the brackets (such as where the multiply takes precedence over
the subsequent addition).

If your calculation is really
=10+10*2+2*10
the *right* answer is 50.
 
If you know how to do it on paper, do the same in Excel

=((10+10)*2+2)*10

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
so, the brackets around 10+10 tells Excel to do that bit first, before it
continues with the rest of the calculation.
What do the brackets around 10+10*2+2 tell Excel to do?
Is it always the very last part of the calculation that doesn't have
brackets around it?

As you can probably tell, maths was never my strongest point and I don't
understand what the second set of bracets are instructing Excel to do.

Thanks again.
Louise
 
Louise said:
so, the brackets around 10+10 tells Excel to do that bit first,
before it continues with the rest of the calculation.
What do the brackets around 10+10*2+2 tell Excel to do?
Is it always the very last part of the calculation that doesn't
have brackets around it?

No. I suggest that you use Excel Help. Enter "operator precedence"
and select the link "The order in which Excel performs operation".
Hopefully that clarifies things for you.
As you can probably tell, maths was never my strongest point
and I don't understand what the second set of bracets are
instructing Excel to do.
[....]
Roelof van Wyk said:
=((10+10)*2+2)*10

Notice that that could be written 10*((10+10)*2+2), demonstrating
that it is not always "the very last part of the calculation that
doesn't have brackets [sic] around it".

As you read left to right, when you see a right parenthesis,
evaluate everything left-to-right until you encounter the matching
left parenthesis. So, first we do "10+10" (20), then we evalutate
"20*2 + 2" (42), and finally we do "42*10" (420). The key is: we
do "20*2" before we do "...+2". If we wanted to do "2+2" before
we do "20*...", we would have to write (10+10)*(2+2)*10, which
yields 20*4*10 = 800.
 
Louise,

Perhaps you could think of the parentheses as a way to tell Excel to do THIS
"first", or "independently".

So your formula:

=10+10*2+2*10

Without parentheses, the normal order of operation, Left to Right, would
apply.

X / + -

So 10*2 would happen first, then 2*10. Then 10 + 20 (the result of 10*2).
Then 30 (the result of the former) plus 20 (the result of 2*10).

In other words, all Multiplication first, then all the addition.

With parentheses:

=((10+10)*2+2)*10

Remember the parentheses say do this "first", or "independently".

The 10+10 is inside its own set of parentheses, so that tells Excel to do
this independently, which comes up with 20. Then we have a *2+2. Remember
left to right, * comes before +, so then we do a *2. This gives us 40. Then
we add two (because the +2 comes inside the larger set of parentheses, we do
this before the *10). This gives us 42. Then we do the *10.

Does that help at all?
 
Hello.

Thank you very much for explaining this to me, yes this makes it clearer.

Thanks again.
Louise
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top