COUNT unique values after filter

afountas

New Member
Joined
Jul 15, 2011
Messages
20
Hello,

I have a table column with 200 enties, 65 which are unique. I need a formula to be able to count only the unique values even after a filter has been applied.

I have this so far, which only counts the unique values, but will not adjust to a filter.

=SUM(IF(FREQUENCY(Table2[DMA Rank],Table2[DMA Rank])>0,1))

Any Ideas?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
The subtotal function should be used instead of the sum function.

The following should point you in the right direction.

=SUBTOTAL(1,IF(FREQUENCY(Table2[DMA Rank],Table2[DMA Rank])>0,1))
 
Upvote 0
Try this version

=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(Table2[DMA Rank],ROW(Table2[DMA Rank])-MIN(ROW(Table2[DMA Rank])),1)),MATCH(Table2[DMA Rank],Table2[DMA Rank],0)),ROW(Table2[DMA Rank])-MIN(ROW(Table2[DMA Rank]))+1),1))

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
Are you sure? I tested the formula and it works OK for me....

What value do you get? Are you applying CTRL+SHIFT+ENTER so that curly braces like { and } appear around the formula?
 
Upvote 0
Hey Barry,

Before the filter, I get a value of 65, which is good. But the formula doesnt react to the filter.

Also, I did make sure to activate the formula with the CTRL +SHIFT +ENTER command
 
Upvote 0
Apologies, badly tested!

I missed a crucial comma in the OFFSET function - should be like this

=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(Table2[DMA Rank],ROW(Table2[DMA Rank])-MIN(ROW(Table2[DMA Rank])),,1)),MATCH(Table2[DMA Rank],Table2[DMA Rank],0)),ROW(Table2[DMA Rank])-MIN(ROW(Table2[DMA Rank]))+1),1))
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

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