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?
 
I want to combine to formulas:


The first:
=COUNTIF(G8:G110,"2")+COUNTIF(G8:G110,"1")


The second:
=SUBTOTAL(9,G8:G110)


Is it possible?


Thanks for any help!
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I'm not an excel proffesional and don't know how to use to information at the link for my needed formula.
 
Upvote 0
Hi,
I'm trying to figure a way to count where a single criteria appears in two columns. I have got this, but it's double the number. I could just halve the result, but is there a more elegant way to do this?

=SUMPRODUCT(
SUBTOTAL(3,OFFSET(
Column 4:Column 5,
ROW(Column 4:Column 5)-MIN(ROW(Column 4:Column 5)), , 1)),
--(Column 4="S"),--(Column 5="S"))
 
Upvote 0
Hi,
I'm trying to figure a way to count where a single criteria appears in two columns. I have got this, but it's double the number. I could just halve the result, but is there a more elegant way to do this?

=SUMPRODUCT(
SUBTOTAL(3,OFFSET(
Column 4:Column 5,
ROW(Column 4:Column 5)-MIN(ROW(Column 4:Column 5)), , 1)),
--(Column 4="S"),--(Column 5="S"))

Would you post a scaled-down sample using XL2BB?
 
Upvote 0
Hi,
I got it to work, but it spawns arrays.

I've moved away from that combo as it's volatile and used helper columns instead. Especially for non-contiguous ranges.

It would be nice to collate hits but limitations of tables, filters limit choices.
Such is life..
 
Upvote 0
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?
There are two ways to it

1. =SUM((C2:C7=C12)*(D2:D7))
2. =SUMPRODUCT(--(C2:C7=C12),--(D2:D7))

1​
RecordTypeAmtFilter
2​
1​
Tax
1200​
A
3​
1​
Fin
5200​
B
4​
2​
Tax
4500​
C
5​
2​
Fin
3500​
B
6​
3​
Tax
4600​
B
7​
3​
Fin
5700​
B
8​
9​
TAX
4600​
10​
FIN
14400​
11​
TAX
12​
TAX10300
10300​
1​
10300​
2​
10300​
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,255
Members
449,075
Latest member
staticfluids

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