Count unique values in Excel

前端 未结 12 2236
别那么骄傲
别那么骄傲 2020-11-28 12:28

I need to count unique values in range (C2:C2080) in excel. Googled formula:

=SUM(IF(FREQUENCY(MATCH(C2:C2080;C2:C2080;0);MATCH(C2:C280;C2:C2080;0))>0;1))         


        
12条回答
  •  孤城傲影
    2020-11-28 12:51

    JustinG's function works very well (and fast) until the number of unique items exceeds 32,767 due to some type of limit in Excel.

    I found if you modify his code

    Public Function CountUnique(rng As Range) As Integer
    

    and make it as...

    Public Function CountUnique(rng As Range) As Long
    

    It will then handle more unique items.

提交回复
热议问题