ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looping puzzle (https://www.excelbanter.com/excel-programming/371339-looping-puzzle.html)

Songoku

looping puzzle
 
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




Tom Ogilvy

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





All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com