I am attempting to create a function in VBA that, when given a range of values, will return a Count Distinct of those values. For example:
| Column A |
|-----
I'll chime in here as well...
Public Function Count_Distinct_In_Column(Rng As Range)
Count_Distinct_In_Column = _
Evaluate("Sum(N(countif(offset(" & Rng.Cells(1).Address _
& ",,,row(" & Rng.Address & "))," & Rng.Address & ")=1))")
End Function
Called like:
? Count_Distinct_In_Column(Range("A2:A12"))
6