Subtotal formula Subtotals greater than zero needed.

Fin Fang Foom

Well-known Member
Joined
Mar 20, 2005
Messages
598
Is there a Subtotal(9, formula that it will only Subtotal greater than zero?
I tried this but does'nt work.

Any Ideas?

=IF(SUBTOTAL(9,S3:S86)>0,SUBTOTAL(9,S3:S86),0)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Yes, just to ignore filtered cells and also ignore the subtotals that are negative.

Is this possible?
 
Upvote 0
Fin Fang Foom said:
Is there a Subtotal(9, formula that it will only Subtotal greater than zero?
I tried this but does'nt work.

Any Ideas?

=IF(SUBTOTAL(9,S3:S86)>0,SUBTOTAL(9,S3:S86),0)

Hi Fin Fang Foom:

Your formula ... =IF(SUBTOTAL(9,S3:S86)>0,SUBTOTAL(9,S3:S86),0)

worked for me. Am I missing something here?
 
Upvote 0
Me too I dont know why it does not work. Look in cell U25 it should be 6.44 The formula should just sum positive Subtotals, Right?


What do you think is the problem?
 
Upvote 0
Hi Fin Fang Foom:

I think the problem is that you are making the wrong comparison.
Book2
UVWX
3
4-1.2
5-0.18
6-0.17
70.29
8-1.26
9
10-2.33
11-2.33
12
130.23
141.69
154.01
165.93
17
180.5
190
200.5
21
22-3.06
23-3.06
24-0.22
250
266.44-0.22-0.22
27
Sheet7


Formula in cell U25 ... =IF(SUBTOTAL(9,U3:U23)>0,SUBTOTAL(9,U3:U23),0)

is correvtly displaying as 0, since the total of the entries in range U3:U23

is to be obtained by either ...

=SUM(U8,U11,U16,U20,U23) as depicted in cell V26
or
=SUM(U3:U23)/2 as depicted in cell W26

I don't know the logic of the formula you used to arrive at the figure in cell U26.
 
Upvote 0
for what it's worth, subtotal() doesn't like conditiona arrays, so if what you are trying to do cn be summarised as:

sum a range of cells, but only those that are both visible after a filter has been applied and greater than zero

...then you'll need a different construction. The filtering hasn't survived the html process, but in the original col a had been filtered to show 'b':
Book2
ABCD
1IDNum8
2a1
3b-1
4a1
5b-1
6a1
7b3
8a1
9b5
Sheet2



Formula is:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(FilterRange,ROW(FilterRange)-MIN(ROW(FilterRange)),,1)),--(FilterRange>0),FilterRange)

...where FilterRange refers to B2:B9
 
Upvote 0
The value is still off a little bit. I'm I doing something wrong?
X24 should be 6.44.

=SUMPRODUCT(SUBTOTAL(3,OFFSET(U3:U23,ROW(U3:U23)-MIN(ROW(U3:U23)),,1)),--(U3:U23>0),U3:U23)

Any Ideas?
 
Upvote 0
Try the following, which will require the use of a helper column...

V4, copied down:

=IF(U5="",U4,"")

Then use the following formula:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(V4:V23,ROW(V4:V23)-MIN(ROW(V4:V23)),0,1)),(V4:V23>0)+0,V4:V23)

or

=SUMPRODUCT(--(SUBTOTAL(9,OFFSET(V4:V23,ROW(V4:V23)-MIN(ROW(V4:V23)),0,1))>0),V4:V23)

Hope this helps!

Edit: Adjusted the range.
 
Upvote 0

Forum statistics

Threads
1,215,034
Messages
6,122,782
Members
449,095
Latest member
m_smith_solihull

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