How to count the number of different items in a range without use a pivot table excel vba -
i have large range various repeating id's. want know how many unique id's in range, don't want use pivot table. this question related, not have answer. there simple way using vba?
i saw this, doesn't work me.
use dictionary
object load unique values, such below:
sub countunique() dim odictionary object dim rngdata range dim ncounter integer set odictionary = createobject("scripting.dictionary") set rngdata = range("a1:a10") 'change range suit ncounter = 0 each cel in rngdata if not odictionary.exists(cel.value) odictionary.add cel.value, 0 ncounter = ncounter + 1 end if next cel msgbox ncounter end sub
Comments
Post a Comment