Thread: loops and count
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default loops and count

You really don't need code to do this

assume your data is in column A and B
in rows 1 to 1000

=Sumproduct(--($A$1:$A$1000=14),--($B$1:$B$1000="X"))

You can replace 1 with a cell reference. So say in E1 to E10 you put in
the numbers 10 to 20

in F1 you would put
=Sumproduct(--($A$1:$A$1000=E1),--($B$1:$B$1000="X"))

then drag fill down to F10.

--
Regards,
Tom Ogilvy


"G" wrote in message
...
Range of cells on a worksheet.

"Tom Ogilvy" wrote:

when you say a 2D array, is this a vba array in memory or are you

talking
about a range of cells on a worksheet?

--
Regards,
Tom Ogilvy


"G" wrote in message
...
Hi The Any assistance will be highly appreciated. I am trying to

loop
through a 2D array where it goes through each row. and counts the Xs
corresponding to the value. For example, Ideally 10 should have a

count of
2
x's, 14 a cnt of 1 x , 12 0 etc..
10 X
12
14 X
13
10 X
10
Thanks in advance
G