Math operation

  • Thread starter Thread starter Marc
  • Start date Start date
True. The addition operator (+) and the subtraction operator (-) have
the same precedence in XL, so they are evaluated stepwise left to right:

=C10+C21+H10-H21

is equivalent to

=(C10+C21)+H10-H21

is equivalent to

=((C10+C21)+H10)-H21

To achieve your second example, you need to use parentheses.

For more, see

The order in which Microsoft Excel performs operations in formulas

in XL Help.
 
JE McGimpsey wrote...
True. The addition operator (+) and the subtraction operator (-)
have the same precedence in XL, so they are evaluated
stepwise left to right:

Precedence (same for + and -) and associativity (left to right fo
both) are not the same thing.
=C10+C21+H10-H21

is equivalent to

=(C10+C21)+H10-H21

is equivalent to

=((C10+C21)+H10)-H21

So far so good.
To achieve your second example, you need to use parentheses.
...

Not quite. If the OP should be taken literally as wanting

(C10+C21)-(H10+H21)

as per

then adding parentheses to

C10+C21+H10-H21

to make

C10+C21+(H10-H21)

does not good. Replacing the third + with - would suffice.

C10+C21-H10-H2
 
True, I misread the OP's example...

Thanks for the correction!
 

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