Add if a number is negative, Subtract if a number is positive

Hsoj1114

New Member
Joined
Aug 25, 2011
Messages
3
<TABLE style="WIDTH: 59pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=79><COLGROUP><COL style="WIDTH: 59pt; mso-width-source: userset; mso-width-alt: 2889" width=79><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 59pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl66 height=20 width=79>I230($349.60)</TD></TR><TR style="HEIGHT: 12pt" height=16><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl64 height=16>I231($349.00)</TD></TR><TR style="HEIGHT: 12pt" height=16><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: #e4dfec; HEIGHT: 12pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl65 height=16>I232($0.60)</TD></TR></TBODY></TABLE>
I want the difference from cell I231 and cell I232 which is right here. but if I230 was a positive number then formula for I232 would be wrong I would have to add I232 and I231 rather than subtract them.

<TABLE style="WIDTH: 59pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=79><COLGROUP><COL style="WIDTH: 59pt; mso-width-source: userset; mso-width-alt: 2889" width=79><TBODY><TR style="HEIGHT: 15pt" height=20><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 59pt; HEIGHT: 15pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl68 height=20 width=79>I230$350.00 </TD></TR><TR style="HEIGHT: 12pt" height=16><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; HEIGHT: 12pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl66 height=16>I231($349.00)</TD></TR><TR style="HEIGHT: 12pt" height=16><TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: #e4dfec; HEIGHT: 12pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl67 height=16>I232$699.00 </TD></TR></TBODY></TABLE>I232 Should say Positive $1

How to I make I232 = I231-I230 if I231 is Negative BUT
I231+I230 if I230 is Positve ??
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the board..

If I231 is actually a negative number, then just simply

I230+I231

That is essentially equated to (I230+-I231)


Excel Workbook
IJ
230$350.00$350.00
231($349.00)$349.00
232
2331699
Sheet1
 
Last edited:
Upvote 0
I think you misunderstood me.

I want cell I232 to give me the difference of I231 and I230

my formula i have for I232 is =I230-I231
which works fine if both numbers are negative or both are positive.

If cell I232 was Positive 345 instead of Negative. the formula would not work i would have to add them instead to get the right difference.

suggestions please... I dont want to have to change the sign in the formula to either add or subtract depending on if the number is positive or not.
 
Last edited:
Upvote 0
Hmmm, but would it not provide you with absolute difference not actual difference? ( positive or negative variance) that is if you are analyzing the variance it is not clear whether it is favorable or not. (unless you are after absolute difference not relative).

Just my humble opinion. :)
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,424
Members
452,914
Latest member
echoix

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top