I have a google spreadsheet that uses this function:
=SUM(E:E) - SUM(C:C)
It adds up all the values of column E and column C and them subtracts the difference. I would like to be able to return a 0 if the difference is negative.
The Excel SIGN function returns the sign of a number as +1, -1 or 0. If number is positive, SIGN returns 1. If number is negative, sign returns -1.
Use the IF function, one of the logical functions, to return one value if a condition is true and another value if it's false. For example: =IF(A2>B2,"Over Budget","OK") =IF(A2=B2,B4-A4,"")
=MAX(SUM(E:E) - SUM(C:C),0) The MAX function receives a list values eg. MAX(1, 2, 3, 4) would give 4 so if you give it 0 then it will return 0 since it's higher than the negative result
IF((SUM(E:E) - SUM(C:C))< 0,0,SUM(E:E) - SUM(C:C))
Possible without changing the existing formula but with formatting such as:
#.00;"0";0
This differs from a formula approach such as =MAX(SUM(E:E)-SUM(C:C),0) because adding a number to the output of that formula will give as a result the added number, where SUM(C:C) is greater than SUM(E:E). Adding the same addend to =SUM(E:E)-SUM(C:C) where SUM(C:C) is greater than SUM(E:E) will not give the addend as the result, except when the added is 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With