SubTotal

MARKEGANDERSON

Active Member
Joined
Apr 7, 2007
Messages
264
Hello All-

I want to count all the "Yes", in a data range define as "CPR_Data", using the SubTotal function.

Can anyone help?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
thanks - This will count all the "YES" in "CPR_Data". I wanted it to count all the "YES" that's filtered. Reason why I wanted to use the subtotal function.

So combining your formula with the subtotal function would work, but I don't know how
 
Upvote 0
If CPR_Data is a single column, then:

=SUM(IF(CPR_Data="yes",IF(SUBTOTAL(103,OFFSET(CPR_Data,ROW(CPR_Data)-ROW(INDEX(CPR_Data,1)),0)),1)))

with Control+Shift+Enter.
 
Upvote 0
I replace the defined name CPR_data with T1:T9812, it works but counting everything in that range even if it is filtered. So Arrival week of 13 AUG has 13 "Yes" in column T. But when I filter by Week of 20 Aug which has 11 "Yes", it gives me a total of 24.

=SUM(IF(T1:T9812="yes",IF(SUBTOTAL(103,OFFSET(T1:T9812,ROW(T1:T9812)-ROW(INDEX(T1:T9812,1)),0)),1)))
 
Upvote 0
I replace the defined name CPR_data with T1:T9812, it works but counting everything in that range even if it is filtered. So Arrival week of 13 AUG has 13 "Yes" in column T. But when I filter by Week of 20 Aug which has 11 "Yes", it gives me a total of 24.

=SUM(IF(T1:T9812="yes",IF(SUBTOTAL(103,OFFSET(T1:T9812,ROW(T1:T9812)-ROW(INDEX(T1:T9812,1)),0)),1)))

You need to confirm this formula with control+shift+enter.

The SUMPRODUCT array-processing equivalent which does not require control+shift+enter is...

=SUMPRODUCT(SUBTOTAL(103,OFFSET(T1:T9812,ROW(T1:T9812)-ROW(INDEX(T1:T9812,1)),0)),--(T1:T9812="yes"))<strike></strike>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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