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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -