LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Count Unique Entries

Is the immediate window in the VBE visible?

As I said:

Output is placed in the immediate window just for demo purposes.


--
Regards,
Tom Ogilvy



"JL" wrote in message
...
Thank you Tom. I'm not seeing any output but am sure I'm just missing
something obvious. I've been reassigned today and am going to have to
continue on with this tomorrow.

"Tom Ogilvy" wrote:

Sub abcdef()
Dim s As String, cell As Range
Dim rng As Range, colKeys As Variant
Dim itm, cnt As Long
Dim i As Long
Dim v As Variant
Dim nodupes As Object
Set nodupes = CreateObject("Scripting.Dictionary")
Set rng = Range(Cells(1, "C"), _
Cells(Rows.Count, "C").End(xlUp))
For Each cell In rng
s = Trim(cell.Text) & "_" & Trim(cell.Offset(0, 1).Text)
cnt = 1
On Error Resume Next
nodupes.Add s, cnt
v = Err.Number
On Error GoTo 0
If v < 0 Then
nodupes.Item(s) = nodupes.Item(s) + 1
Err.Clear
End If
Next
colKeys = nodupes.Keys
For i = LBound(colKeys) To UBound(colKeys)
Debug.Print colKeys(i), nodupes.Item(colKeys(i))
Next
End Sub

will give you a list of uniques and count of rows.

Output is placed in the immediate window just for demo purposes.

--
Regards,
Tom Ogilvy


"JL" wrote:

The part I am really having a problem with is counting the quantity in

each
unique combination of columns C & D so I can create the array to store

the
rows in. IOW, there may be one row with "Apples" and "Oranges" in

columns C
& D, 5 rows with "Apples" and "Pears" in C & D... I need to count

each
combination one at a time so I can create the array, perform my

processing,
then count the number in the next unique combination...

JL

"Tom Ogilvy" wrote:

Possibly this code will be helpful:

http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy


"JL" wrote:

I have a sheet sorted on columns C & D. Starting with "C1:D1", I

need code
to store each row to myArray that has data in columns C & D

matching "C1:D1"
so I can process the rows, then find the next unique combinatioin

of "C1:D1",
store all of those rows to an myArray for processing. As I

mentioned the
sheet is already sorted so that may make things a little easier.

-JL-



 
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
count unique entries driller2[_2_] Excel Discussion (Misc queries) 5 November 30th 09 05:02 AM
Count unique entries... ChuckF Excel Worksheet Functions 5 October 12th 06 05:48 AM
Count Unique Entries SouthCarolina Excel Worksheet Functions 4 April 14th 06 11:44 PM
Count unique entries Cash Excel Discussion (Misc queries) 4 April 4th 06 09:44 PM
Count of unique entries slang Excel Discussion (Misc queries) 4 July 3rd 05 06:45 AM


All times are GMT +1. The time now is 01:13 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"