Difference

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

Guest

I am sure there is a very simple answer to this.

I need to calulate the difference between 2 cells (each cell is a SUM of the
information of other cells).

the content of each of these cells could be +ve or -ve. Thus, if A is -45
and B is 200, then the difference is 245.

Is there a simple was of doing this, rather than a long winded IF IF IF
command.
 
Maybe a slight tweak

=ABS(A1-B1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
=B1-A1 gives 245 with your example numbers, Excel knows elementary maths, why
didn't you try it?

Regards,
Stefi

„Stevep-4†ezt írta:
 
set up cell 'C' with =if(A>B,A,B) and set up cell 'D' with =if(A<B,A,B)
then in cell 'E' have =C-D, which is the difference between the values.

ensuring that you have the larger value in cell 'C' will stop you from
achieving a negative value for the difference.
 
to produce the result using one cell use
=if((A-B)<=0,((A-B)+(2*(0-(A-B)))),(A-B))
 
Thanks Hot dogs, that works. The other suggestions do not work due to the
fact that either cells A or B can be negative.
Thus
If A= -45 and B= 45. Difference is 90
If A= 45 and B= -45. Difference is 90.


Is there a simpler method though, that can be done in one cell? for example
=DIFF(A:B)
 
Stevep-4 said:
I am sure there is a very simple answer to this.

I need to calulate the difference between 2 cells (each cell is a SUM of
the
information of other cells).

the content of each of these cells could be +ve or -ve. Thus, if A is -45
and B is 200, then the difference is 245.

Is there a simple was of doing this, rather than a long winded IF IF IF
command.

=B1-A1
or
=ABS(B1-A1)
depending on what you want.
 
Thanks Bob
Hadn't noticed the OP wanted 245 and not -245 as his result.
 
See my amendment to Roger's response.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
ABS(B1-A1) works perfectly whether A or B (or both) are negative.

Thanks.
 
What's wrong with =ABS(A1-B1)? (or =ABS(B1-A1)?)
Doesn't that give 90 for each of your examples?
 

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

Similar Threads

Adding up within a cell during data input 3
Sumproduct...Average 2
Excel 2000 3
Setting up macro betwen two sheets 1
Copy to another worksheet 3
Conditional sumif? 5
Counting +ve values? 4
Excel Import Comments 3

Back
Top