LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default VBA in Counting Unique Values

The VB collection is quite slow and COUNTU can be made about 8 times
faster by using the cCollection object that is in the free file
dhRichClient3:
www.datenhaus.de/Downloads/dhRichClient3.zip
http://www.datenhaus.de/Downloads/dh...ient3-Demo.zip

Using that COUNTU would be something like this:

Public Function COUNTU2(theRange As Range) As Variant

Dim i As Long
Dim cCol As cCollection
Dim vCell As Variant
Dim vArr As Variant
Dim oRng As Range

Set oRng = Intersect(theRange, theRange.Parent.UsedRange)
vArr = oRng

Set cCol = New cCollection
cCol.CompatibleToVBCollection = False

For Each vCell In vArr
If cCol.Exists(vCell) = False Then
cCol.Add 0, vCell
End If
Next vCell

COUNTU2 = cCol.Count

End Function


RBS


"Bernd P" wrote in message
...
Hello,

Look at my runtime comparisons, I suggest:
http://www.sulprobil.com/html/count_unique.html

Regards,
Bernd


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting unique values blswes Excel Worksheet Functions 4 August 14th 08 06:50 PM
Counting unique values doofus1981 Excel Discussion (Misc queries) 7 April 3rd 08 01:56 PM
Counting Unique Values LaDdIe Excel Programming 9 December 3rd 07 08:11 PM
Counting unique values giantwolf Excel Discussion (Misc queries) 4 August 28th 06 01:31 PM
Counting unique values JK57 Excel Worksheet Functions 3 July 7th 06 01:02 AM


All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"