Countif on filtered worksheet

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
OK, I am well and truly puzzled with this one

I have a sheet which contains filters, however I need to use a countif based on criteria of the filter & I only want to count the visible names down column A

I was attempting to modify

=countif(subtotal(2,Analysis!A:A),Sheet4!J2)

But this will not work, is there a better method?

TIA
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
What is the criteria for your filter? Can you incorporate this criteria into a SUMPRODUCT formula?
 

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
What is the criteria for your filter? Can you incorporate this criteria into a SUMPRODUCT formula?

Column R being filtered to NOC, on sheets tab called "Analysis"

??? :unsure:
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Try

=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1:A100,ROW(A1:A100)-ROW(A1),,1)),--(A1:A100=sheet4!J2))
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092

ADVERTISEMENT

Try something like:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(Analysis!A$2:A$10,ROW(Analysis!A$2:A$10)-ROW(Analysis!A$2),0,1)),--(Analysis!A$2:A$10=Sheet4!J2))

Adjust the ranges to suit, but they can't be entire columns.
 

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
Hi Guys,

Whilst both formula's work, neither return any count?

Andrew - I changed yours to

=SUMPRODUCT(SUBTOTAL(3,OFFSET(Analysis!A$2:A$1000,ROW(Analysis!A$2:A$1000)-ROW(Analysis!A$2),0,1)),--(Analysis!A$2:A$10=Sheet4!H2))
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092

ADVERTISEMENT

You have to change all the ranges:

SUMPRODUCT(SUBTOTAL(3,OFFSET(Analysis!A$2:A$1000,ROW(Analysis!A$2:A$1000)-ROW(Analysis!A$2),0,1)),--(Analysis!A$2:A$1000=Sheet4!H2))
 

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
You have to change all the ranges:

SUMPRODUCT(SUBTOTAL(3,OFFSET(Analysis!A$2:A$1000,ROW(Analysis!A$2:A$1000)-ROW(Analysis!A$2),0,1)),--(Analysis!A$2:A$1000=Sheet4!H2))

Again, it works, but does not return anything other than 0
:unsure: :unsure:
 

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
So what's in Sheet4!H2, and does that exist in Analysis!A2:A1000?

I’ve cheated

I took a PSV of the filtered sheet, into a xlveryhidden sheet, then bounced the countif off that using a button

Thanks for the ideas however
 

Watch MrExcel Video

Forum statistics

Threads
1,122,597
Messages
5,597,091
Members
414,122
Latest member
eazyyexcel

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
Top