UPDATED with questions still: So I've used count before and haven't had issue. However I am trying to get a total for each unique value in a spreadsheet. I'm using vb script because I need this to be outside of excel for several reasons. So if my data is like :
Bob
Bob
Ted
Ann
Ann
I'm looking for the results to be
Bob =2
Ted = 1
Ann = 2
etc...
This is what I have so far, which gets me my unique count but not a total for the unique items...
Dim objDict,item,arr,cRow, result,count
Set objDict = CreateObject("Scripting.Dictionary")
arr= .Sheets(1).Range("A2:A" & iLastRow )
For Each key In arr
If key <>"" Then
If Not objDict.Exists(key) Then objDict.Add key, Nothing
else
objDict.key("name").Item = objDict.Item() + 1
end if
End If
Next
I've updated with Marks suggestion, yet I continue to get hung up on key. I'm not understanding how to use in this situation. From the help file Mark supplied, the example is adding a key and an item. I'm just adding keys, so what am I missing here?
Thanks for any help in this. Just pointers in the right direction are most welcome.