How to Sum Only Positive Numbers in Columns not Next To Each Other

SanFelippo

Board Regular
Joined
Apr 4, 2017
Messages
124
I originally thought this was going to be a simple formula, but I realized that the usual SUMIF and/or SUMIFs formulas doesn't work for this situation. And no, I unfortunately can't moved columns around to make this easier.

So here is an example
ABCDEFGHI
14-567834-4
-236432467

So in this example, I need a formula that will sum together the Row values that are in Columns C,F,and I only if they are positive values

So the output in some other cells for Row 1 and 2 would be as follows:

Row 1 Output (put it in Cell J1): 8
Row 2 Output (put in Cell J2): 15

Does that make sense? I do have a formula that does work, but it involved coding every single situation and the corresponding sum (Combination and Permutations stuff). In my actual workbook, it looks like this:

Rich (BB code):
=IF(AND(P4>=0,X4>=0,AB4>=0),SUM(P4,X4,AB4),IF(AND(P4>=0,X4>=0,AB4<0),SUM(P4,X4),IF(AND(P4>=0,AB4>=0,X4<0),SUM(P4,AB4),IF(AND(X4>=0,AB4>=0,P4<0),SUM(X4,AB4),IF(AND(P4<0,X4<0,AB4>=0),AB4,IF(AND(P4<0,X4>=0,AB4<0),X4,IF(AND(P4>=0,X4<0,AB4<0),P4,IF(AND(P4<0,X4<0,AB4<0), 0,""))))))))

This works but it is ugly. I figure there has got to be an easier way to do this. Any thoughts?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How about:

=SUM(IF(C1>0,C1),IF(F1>0,F1),IF(I1>0,I1))

If you have more cells to consider, there are ways to not have to explicitly list the cells, if they have a pattern.
 
Upvote 0
Not sure I understand your sample, but based on your formula, does this work for you?

=SUM(MAX(P4,0),MAX(X4,0),MAX(AB4,0))
 
Upvote 0
If you are going to add more columns and the sum is every three columns, you can try the following:

Dante Amor
MNOPQRSTUV
1
2
3
414-567834-48
5-23643246715
S1
Cell Formulas
RangeFormula
V4:V5V4=SUMPRODUCT((MOD(COLUMN($M$1:$U$1),3)=0)*(M4:U4>0)*(M4:U4))
 
Upvote 0
Another approach to consider:
=SUMPRODUCT(C3*(C3>0)+F3*(F3>0)+I3*(I3>0))
 
Upvote 0
How about:

=SUM(IF(C1>0,C1),IF(F1>0,F1),IF(I1>0,I1))

If you have more cells to consider, there are ways to not have to explicitly list the cells, if they have a pattern.


I am actually really disappointed in myself. This was the easiest work around ever and I should have seen it immediately.

This works perfectly. Thanks a bunch everyone.
 
Upvote 0
For 3 cells, it could be:

=IF(C1>0,C1)+IF(F1>0,F1)+IF(I1>0,I1)
 
Upvote 0
I'm an expert in overlooking the obvious myself! Sometimes another set of eyes can really make a difference. Glad we could help. :)
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,666
Members
449,091
Latest member
peppernaut

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