Hi,
I'm trying to essentially perform a COUNTIF using a dictionary in VBA as I have a ton of data.
What I want to do is just:
- Go through each cell in a range
- If the cell value doesn't exist in the dictionary, add it to the dictionary with a count of 1
- If the cell value does exist in the dictionary, update it's count field by adding 1
- Once completed, loop back through the initial range and then output onto the sheet the count for each item
----------------------
What I have done so far:
- I've created a Class Module with two variant fields, ID and Count
- I can then look to my range and add each item to the dictionary
- HOWEVER, when trying to do something like:
If MyDictionary.Exists(r.Value) Then ...
It never works.
If someone can help, that would be fantastic. If there is more information/code you'd like me to share, just say so.
Thanks!
Bookmarks