Dealing with duplicate numbers in dictionary

tomleitch

Board Regular
Joined
Jan 3, 2012
Messages
189
Hi everyone - I'm looking for some help with managing a dictionary where I have items that have an index number and some items have the same number.

Looking for guidance on how to deal with this.

As it stands - column "A" has my index number and there are further columns of data that I am building into a dictionary array... but I have noticed that some things have multiple entries (or items in the list) with the same index number.

VBA Code:
 With CreateObject("scripting.dictionary")
 
 
      For Each cl In ws4.Range("A2", ws4.Range("A" & Rows.Count).End(xlUp))
    
      If Not .exists(cl.Value) Then .Add cl.Value, Array(cl.Offset(, 1).Value, cl.Offset(, 2).Value, cl.Offset(, 3).Value, cl.Offset(, 4).Value, cl.Offset(, 5).Value, cl.Offset(, 6).Value, cl.Offset(, 7).Value, cl.Offset(, 8).Value, cl.Offset(, 9).Value)
                
      Next cl

Following this my code is looking at existing range data and updating/comparing items.... but I don't know how I can do this if I have two items with the same number.

Any advice appreciated.

Thanks
Tom
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I can see, for first found, you add an array of 9 next columns
If, for 2nd found, what would you do? add more 9 next columns (to become array with 18 items) or something else?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top