Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count unique entries | Excel Discussion (Misc queries) | |||
Count unique entries... | Excel Worksheet Functions | |||
Count Unique Entries | Excel Worksheet Functions | |||
Count unique entries | Excel Discussion (Misc queries) | |||
Count of unique entries | Excel Discussion (Misc queries) |