Thread: looping puzzle
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default looping puzzle

D1:
=sumproduct(--(A1=$B$1:$B$200),--(A1<=$C$1:$C$200))

then drag fill down the column. change the 200 to refer to the extent of
the data. The fewer cells included, the faster this will recalculate.

--
Regards,
Tom Ogilvy


"Songoku" wrote:

Hi,

new to VB, just a quick one I have a worsheet that contains 3 columns

column 1 = 4am to 10.30pm in 5 miniute breaks ie (4.00,4.05,4.10 etc)
column 2 = various times between 4am and 10.30pm
column 3 = various times between 4am and 10.30pm

what I want is to count how many times each cell in column 1 is between the
times in columns 2 and 3 and output the result into a cell, then by looping
repeat the same for the next cell in column 1

any ideas mucho appreciated...

just guessing here but something similar to below but without the bad syntax?

for each cell in range(a1,a231) count between range(c1,d781)
store result in cell g1
next count
store result in cell g2

etc