Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Darcy Jones   on Mar 23 In MS Office Category.

  
Question Answered By: Elisabeth Bell   on Mar 23

Copied straight out of the VB module:
Function UniqueCount(rngCells As Range) As Integer

Dim vCell As Variant

' Setup dictionary
Dim unique  As Object
Set Unique = CreateObject("Scripting. Dictionary")

' Populate dictionary
For Each vCell In rngCells
If Not Unique.exists(vCell.Value) Then
Unique.Add vCell.Value, vCell.Value
End If
Next vCell

' Count unique items
UniqueCount = Unique.Count

' Clean up
Set Unique = Nothing

End Function


Calling the function in cell B4 with a named range (MyRange) of text values;
=UniqueCount(MyRange)
also tried manually setting a range of cells:
UniqueCount(A2:A7)

Share: 

 

This Question has 14 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on unique counts Or get search suggestion and latest updates.


Tagged: