SOLVED

Shorten an 'SUM - IF' formula?

Iron Contributor

I have a monthly budget sheet in which I use the below formula (this a 'short version' of the actual formula) to see how much I have paid on monthly bills, to date. Of course, I enter a negative value for how much I plan to pay and then when I do pay a positive value for how much I actually pay. The actual formula contains values for '38' rows. Is there a way to shorten this formula?   [=SUM((IF(I7<0,0,(I7)))+(IF(I8<0,0,(I8)))+(IF(I9<0,0,(I9)))+(IF(I10<0,0,(I10)))+(IF(I11<0,0,(I11)))+(IF(I12<0,0,(I12)))+(IF(I14<0,0,(I14)))+(IF(I15<0,0,(I15))))]. Thank you one & all, in advance!!!

9 Replies
best response confirmed by dlcartin (Iron Contributor)
Solution

@dlcartin 

It would be nice to if you upload a pic of you Excel, as i understand you only need to sum the positive number, use =SUMIF(I7:I15,">0") to sum up positive numbers and use =SUMIF(I7:I15,"<0") to sum up the negative numbers. 

@bovasclion, That's true, but I hadn't thought of in those terms, I'll see if I can set up a file to upload here. Thank you so much!

@bovasclionHi,

   Here is a sample of my monthly sheet. 'I41' is the location of the formula that I'm hoping to shorten. Thanks again!

@dlcartin 

Here are 3 variants of the practically the same formula.

image.png

Most preferable is one suggested by @bovasclion . Difference in results is due to cumulative rounding error in your long formula.

@dlcartin  The answers by @bovasclion  and @Sergei Baklan are both right except that the difference in the sum is due to your original formula skipping row 13 either because it is bad luck or by accident or maybe you intentionally don't want to check/add-in USCCA.  The above formulas help prevent that accidental mistake.  If it was intentional then you could either use the above equations with 2 ranges or just subtract that cell afterwards.

@mtarler 

Oh, thank you! I checked only 5 and 7 at the end before posting, my fault.

@mtarlerI was totally unaware that row 13 wasn't included, thank you for pointing that out!

@bovasclionThe 2nd 'version' as suggested by @Sergei Baklan (which I assume is a 'merged' version of what you have suggested) is the only one that I can make heads or tails of, and when looking at your suggestion actually makes sense. Thank you one & all for taking the time to look at my problem AND coming up with a much shorter solution! I clicked "Best" for your response because you opened my eyes to what was actually being accomplished within the formula. If only I could click "Best" for ALL responses! Thank you all, again!!! Have a Blessed Day!!!

@dlcartin , glad to help

1 best response

Accepted Solutions
best response confirmed by dlcartin (Iron Contributor)
Solution

@dlcartin 

It would be nice to if you upload a pic of you Excel, as i understand you only need to sum the positive number, use =SUMIF(I7:I15,">0") to sum up positive numbers and use =SUMIF(I7:I15,"<0") to sum up the negative numbers. 

View solution in original post