Change search range due to first result

JamieGoetz

New member
Joined
Nov 21, 2014
Messages
5
Reaction score
0
Points
0
Hello,
I have a set or criteria that requires 2 or more separate one hour periods to have >=2 cars. Keep in mind, it doesn't have to be whole hours. Each 15 min starts a new 60 min period. As shown below, at 12:00 1 car returns No. 12:15 returns Yes. 12:30 and 12:45 have 2 or more but don't count anymore because they occupy the same 60min as the first instance.
I am trying to come up with a formula that finds the first instance of >=2 in the cars column. It then must skip the next three 15 min intervals and continue the search.

ABCDE
1TimeCars
212:001No
312:152Yes
412:302N/A
512:453N/A
613:001N/a
713:151No
813:302Yes
913:451N/A
1014:002N/A
 
Does this formula work for you?

=IFERROR(IF(COUNTIF(B$2:B2,">=2")=1,"Yes",IF(AND(B2>=2,A2>=LOOKUP(2,1/($C$1:C1="Yes"),$A$1:A1)+TIME(0,45,0)),"Yes","No")),"No")

copied down
 
ABCD
1TimeCars
212:001No
312:152Yes
412:302N/A
512:453N/A
613:001N/a
713:151No
813:302Yes
913:451N/A
1014:00
It did not. I made an error in the original chart. The A column is time. Numbers 1-10 were row numbers.
 
My formula was based on that (i.e. the header, Time, is in A1. My formula would then be placed in C2 and copied down.

here are my results:

TimeCars
12:001No
12:152Yes
12:302No
12:453No
13:001No
13:151No
13:302Yes
13:451No
14:002No
 
That did it. Thank you. Is there a name for that type formula?
 
Hello, I just found a problem with the formula. Using our original inputs, it works fine. When I use different numbers, I get "Yes" down the column. For example, if I have 1 car at 12:00, 2 cars at 12:15 and one car the rest of the way, I get yes from 12:15 down.
 
Try this adjustment:

=IFERROR(IF(AND(B2=2,COUNTIF(B$2:B2,">=2")=1),"Yes",IF(AND(B2>=2,A2>=LOOKUP(2,1/($C$1:C1="Yes"),$A$1:A1)+TIME(0,45,0)),"Yes","No")),"No")
 
=IFERROR(IF(AND(B2>=2,COUNTIF(B$2:B2,">=2")=1),"Yes",IF(AND(B2>=2,A2>=LOOKUP(2,1/($C$1:C1="Yes"),$A$1:A1)+TIME(0,60,0)),"Yes","No")),"No").

I worked with some mods as shown in red above. Thanks again.
 
Back
Top