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: Ana Bradley   on Mar 23

: However, any time I update a manager, it takes several minutes
: for the array to recalculate the 3000+ lines. Can you think of a
: faster method?

How about tracking the unique  manager names in a dictionary
object? Use this as a user defined function. I named the test
range "managers". This is a generic function. It should work on
any range of values.

=UniqueCount(managers)

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
Next vCell

' Count unique items
UniqueCount = Unique.Count

' Clean up
Set Unique = Nothing

End Function

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: