Count Unique Visible Values with Criteria

CokeOrCrack

Board Regular
Joined
Dec 13, 2015
Messages
81
Hello:

Is there a formula that can count only the visible and unique values in a column, based on criteria from another column?

This array formula I have counts the unique values with criteria, but it ignores filters and counts non-visible cells.

{=SUM(--(FREQUENCY(IF(Clean[Date]<>"",IF(Clean[Year]=YEAR(NOW()),MATCH(Clean[Date],Clean[Date],0))),ROW(Clean[Date])-ROW(INDIRECT("D15"))+1)>0))}

Thanks

OJ
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Try...

Code:
=SUM(IF(FREQUENCY(IF(SUBTOTAL([COLOR=#ff0000]3[/COLOR],OFFSET(Clean[Date],ROW(Clean[Date])-MIN(ROW(Clean[Date])),0,1))>0,IF(Clean[Year]=YEAR(NOW()),MATCH(Clean[Date],Clean[Date],0))),ROW(Clean[Date])-MIN(ROW(Clean[Date]))+1)>0,1))

However, if the year in Clean[Year] will always match the year in Clean[Date], the second condition can be omitted as follows...

Code:
=SUM(IF(FREQUENCY(IF(YEAR(SUBTOTAL([COLOR=#ff0000]9[/COLOR],OFFSET(Clean[Date],ROW(Clean[Date])-MIN(ROW(Clean[Date])),0,1)))=YEAR(NOW()),MATCH(Clean[Date],Clean[Date],0)),ROW(Clean[Date])-MIN(ROW(Clean[Date]))+1)>0,1))

Note, if you also want to exclude rows that have been manually hidden, replace the 3 and 9 in red with 103 and 109, respectively.

Also, note that both formulas need to be confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,972
Members
452,540
Latest member
haasro02

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