Countif unique values for visible cells

jakjok

New Member
Joined
Oct 5, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi

I want to retrieve the Countif unique values for visible cells

so for Countif unique values its working fine using this query:

=SUM(IF(D2:D3134<>"",1/COUNTIF(D2:D3134,D2:D3134), 0))

i tried to add the point for having that working only for filtered cells with luck.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I think subtotal or your aggregate function would work.
 
Upvote 0
i tried these tow way with no luck.
=SUMPRODUCT(SUBTOTAL(3,OFFSET(D2:D3134,ROW(D2:D3134)-MIN(ROW(D2:D3134)),,1)),--(SUM(IF(D2:D3134<>"",1/COUNTIF(D2:D3134,D2:D3134), 0))))
=SUM(IF(D2:D3134<>"",1/SUMPRODUCT(SUBTOTAL(3,OFFSET(D2:D3134,ROW(D2:D3134)-MIN(ROW(D2:D3134)),,1))), 0))
 
Upvote 0
You cannot use arrays in Aggregate unless you are using option 14 to 19.
 
Upvote 0
Try:

=SUM(SIGN(FREQUENCY(IF((D2:D3134<>"")*SUBTOTAL(103,OFFSET(D2,ROW(D2:D3134)-ROW(D2),0)),MATCH(D2:D3134,D2:D3134,0)),ROW(D2:D3134)-ROW(D2)+1)))

Depending on the update level of your Excel 365, you may or may not need to confirm that with Control+Shift+Enter.
 
Upvote 0
Another option if you have dynamic arrays
=COUNT(FILTER(ROW(D2:D3134),(D2:D3134<>"")*(SUBTOTAL(103,OFFSET(D2,ROW(D2:D3134)-ROW(D2),0)))))
 
Upvote 0
Fluff, I think you need a UNIQUE in there, and a couple other tweaks:

=COUNTA(UNIQUE(FILTER(D2:D3134,(D2:D3134<>"")*(SUBTOTAL(103,OFFSET(D2,ROW(D2:D3134)-ROW(D2),0))))))
 
Upvote 0
Oops, :oops:
Missed the bit about unique values.
 
Upvote 0
I prefer to use Rows, rather than Counta in case there is a chance that all visible cells in the range are blank.
Rows will return an error, whereas Counta will return 1
=ROWS(UNIQUE(FILTER(D2:D3134,(D2:D3134<>"")*(SUBTOTAL(103,OFFSET(D2,ROW(D2:D3134)-ROW(D2),0))))))
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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