Subtotal Function and Countif/Sumif

SpikeGiles

New Member
Joined
Oct 27, 2011
Messages
17
The subtotal function is great when working with data you want to filter several ways, but it lacks the functionality that would exist if it had a countif and a sumif code, unless I am missing something. Does this functionality exist within Excel? If not, is there a work-around?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You can use sumif within subtotal, you just have to approach it differently.

Something like this would sum a filter range based on the criteria being being "limited"

=SUMPRODUCT(SUBTOTAL(9,OFFSET($B$2:$B$10,ROW($A$2:$A$10)-MIN(ROW($A$2:$A$10)),,1)),--($A$2:$A$10="Limited"))

You can pretty much do anything with Excel
 
Upvote 0
Col.Row
ABCDE
1RecordTypeAmountFilter
21Tax 1200A
31Fin5200B
42Tax 4500C
52Fin3500B
63Tax4600B
73Fin5700B
8
9SUMIF TOTALTax4600Regardless of Filtering
10Fin14400
11
12SUBTOTAL SUMIFTax?To consider only filtered items
13Fin?

<tbody>
</tbody><colgroup><col><col><col span="6"></colgroup>


What would my formula in D12 and D13 be:

I am having a hard time interpretting your below answer from a previous reply of yours to another user and and how to apply to my data (sample above)
'=SUMPRODUCT(SUBTOTAL(9,OFFSET($B$2:$B$10,ROW($A$2:$A$10)-MIN(ROW($A$2:$A$10)),,1)),--($A$2:$A$10="Limited"))
 
Upvote 0
You can also use a Helper column with the count or counta function for each cell in a column.
Then use that column if a countifs

if you want to do say
=COUNTIF(A$2:A$100,B2)
But only count the visible rows

Put this in an available column (Say C)
In C2 and filled down put
=SUBTOTAL(3,A2)

Then you can use
=COUNTIFS(A$2:A$100,B2,C$2:C$100,1)
 
Upvote 0
Ooops, now I'm even more confused.

Basically in my text version data sample in D12, I want to have a formula that will add column D amounts if Column C values are equal to C12 criteria but only adding up the filtered displayed items.
 
Upvote 0
Ooops, now I'm even more confused.

Basically in my text version data sample in D12, I want to have a formula that will add column D amounts if Column C values are equal to C12 criteria but only adding up the filtered displayed items.

See post #5...
 
Upvote 0
Is $2$2 in your sumproduct(subtotal) answer supposed to be $D$2. Even if I change to $D$2, Excel tells me "too few arguments for this function"
 
Upvote 0
Is $2$2 in your sumproduct(subtotal) answer supposed to be $D$2. Even if I change to $D$2, Excel tells me "too few arguments for this function"

I already edited the bit...
Rich (BB code):
=SUMPRODUCT(   
    SUBTOTAL(9,OFFSET($D$2:$D$10,ROW($D$2:$D$10)-ROW($D$2),0)),
    --($C$2:C$10=$C12))
 
Upvote 0
Your edited code is still not working for me. It results in 0, whether I filter or not.

This is what I have in my formula cell

=SUMPRODUCT(SUBTOTAL(9,OFFSET($D$2:$D$10,ROW($D$2:$D$10)-ROW($D$2),0)),--($C$2:C$10=$C12))
 
Upvote 0

Forum statistics

Threads
1,215,109
Messages
6,123,137
Members
449,098
Latest member
Doanvanhieu

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