View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Count duplicates in an array?

If it is just a single dimension, zero based array, the only way I can see
is to loop through each element and check it.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"quartz" wrote in message
...
Thanks Bob, but no, this array is already in code and contains dynamic
data collected from multiple sheets based on user's input - on the fly.

Any further help appreciated...

"Bob Phillips" wrote:

If we are talking all worksheet cells here, and say the array is in

M1:M8,
then use

=COUNTIF($M$1:$M$8,A1)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"quartz" wrote in message
...
I am using Office 2003 on Windows XP.

I need to be able to count the number of each item in a single element
array, then write out the counts.

For example, if the array contains:
Red, Blue, Red, Orange, Orange, Red, Green, Blue

My result would be:
A1: Red B1: 3
A2: Blue B2: 2
A3: Orange B3: 2
A4: Green B4: 1

If anyone has a function to which I could pass my array to output the

counts
or could share some code I could adapt it would be most appreciated.

Thanks much in advance.