Formula to avoid going negative when one value minus another

Woofy_McWoof_Woof

Board Regular
Joined
Oct 7, 2016
Messages
60
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm trying to calculate a formula that if the result is less than zero then it returns the delta value but is capped at zero instead of the negative result and to then show the residual amount in the cell next to it.

For instance cell A2=+20, cell B2=-70, cell C2 should be A1+B1 which should in theory =-50 but I want it to show -20 and then show -50 in cell D2

First resultChangePositive onlyNegative only
20-70-20-50
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
in negative only cell

=If(A1+b1<0, a1+b1, "")
in positive only

why is the result -20 ?
is that because its 0-20

if so
=If(A1+b1<0, first result cell * -1 , "")

Book2
ABCD
1First resultChangePositive onlyNegative only
220-70-20-50
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(A2+B2<0, A2* -1, "")
D2D2=IF(A2+B2<0, A2+B2, "")


but i may have it wrong - so more examples would help
 
Upvote 0
in negative only cell

=If(A1+b1<0, a1+b1, "")
in positive only

why is the result -20 ?
is that because its 0-20

if so
=If(A1+b1<0, first result cell * -1 , "")

Book2
ABCD
1First resultChangePositive onlyNegative only
220-70-20-50
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(A2+B2<0, A2* -1, "")
D2D2=IF(A2+B2<0, A2+B2, "")


but i may have it wrong - so more examples would help
Hi, the 'Positive Only' result is due to the original +20 minus the 70 but capped at zero so in effect it shows there is a reversal of -20 to get to the zero.
 
Upvote 0
in negative only cell

=If(A1+b1<0, a1+b1, "")
in positive only

why is the result -20 ?
is that because its 0-20

if so
=If(A1+b1<0, first result cell * -1 , "")

Book2
ABCD
1First resultChangePositive onlyNegative only
220-70-20-50
Sheet1
Cell Formulas
RangeFormula
C2C2=IF(A2+B2<0, A2* -1, "")
D2D2=IF(A2+B2<0, A2+B2, "")


but i may have it wrong - so more examples would help
That's spot on, thanks. I'll try it in my master spreadsheet, drag it down and test it out. Thanks a lot :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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