ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Difference (https://www.excelbanter.com/excel-discussion-misc-queries/112756-difference.html)

Stevep-4

Difference
 
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.

Roger Govier

Difference
 
Hi Steve

Why not just =A1-B1 ?

--
Regards

Roger Govier


"Stevep-4" wrote in message
...
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.




Bob Phillips

Difference
 
Maybe a slight tweak

=ABS(A1-B1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Roger Govier" wrote in message
...
Hi Steve

Why not just =A1-B1 ?

--
Regards

Roger Govier


"Stevep-4" wrote in message
...
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.






Stefi

Difference
 
=B1-A1 gives 245 with your example numbers, Excel knows elementary maths, why
didn't you try it?

Regards,
Stefi

€˛Stevep-4€¯ ezt Ć*rta:

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.


hot dogs

Difference
 
set up cell 'C' with =if(AB,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.

"Stevep-4" wrote:

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.


hot dogs

Difference
 
to produce the result using one cell use
=if((A-B)<=0,((A-B)+(2*(0-(A-B)))),(A-B))

"Stevep-4" wrote:

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.


Stevep-4

Difference
 
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)


"hot dogs" wrote:

set up cell 'C' with =if(AB,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.

"Stevep-4" wrote:

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.


David Biddulph

Difference
 
"Stevep-4" wrote in message
...
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.
--
David Biddulph



Roger Govier

Difference
 
Thanks Bob
Hadn't noticed the OP wanted 245 and not -245 as his result.

--
Regards

Roger Govier


"Bob Phillips" wrote in message
...
Maybe a slight tweak

=ABS(A1-B1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Roger Govier" wrote in message
...
Hi Steve

Why not just =A1-B1 ?

--
Regards

Roger Govier


"Stevep-4" wrote in message
...
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.








Bob Phillips

Difference
 
See my amendment to Roger's response.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Stevep-4" wrote in message
...
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)


"hot dogs" wrote:

set up cell 'C' with =if(AB,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.

"Stevep-4" wrote:

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.




Stevep-4

Difference
 
ABS(B1-A1) works perfectly whether A or B (or both) are negative.

Thanks.




"David Biddulph" wrote:

"Stevep-4" wrote in message
...
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.
--
David Biddulph




David Biddulph

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

"Stevep-4" wrote in message
...
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)


"hot dogs" wrote:

set up cell 'C' with =if(AB,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.


"Stevep-4" wrote:

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.





All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com