if and sum

i8ig

Board Regular
Joined
Jul 17, 2007
Messages
122
I need a formula which says if(sum(b1-a1) is less than 0 then display 0, if greater then display the sum of b1-a1

any suggestions?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Thanks, worked good in 1st cell, but other cells without a value in them produce a value error, any other suggestions
 
Upvote 0
That works for me with blank cells. Maybe they contain spaces or similar. Try

=IF(ISERROR(B1-A1),0,MAX(0,B1-A1))
 
Upvote 0
That helped, however if b1 has a value in it and c1 does not, I still receive a negative number Is there a way to have either a blank or 0 show up in the cell with the formula in it?
 
Upvote 0
With either cell empty I do not get negative numbers. Can you give an example that produces a negative number.
 
Upvote 0
cell a2 contains the formula =sum(b1)

using the formula provided a negative number is returned. formula provided is in cell d

cell a2 contains the number 11, when the formula provided is inserted in cell d2 a value of -11 is returned
 
Upvote 0
Thanks, still get a negative number, however if I move down and start a new series the 0 is returned properly
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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