Formula Help with overlapping times

yessir

Board Regular
Joined
Jun 7, 2019
Messages
103
Office Version
  1. 2021
Platform
  1. MacOS
I am trying to find a formula that would help me find how many cars overlap and are in the lot at the same time but only when column D is False. I would then want to count how many cars are in the lot at the same time. The start times are located in B2:B7 and end times are in C2:C7. I've tried using a SUMPRODUCT function but was wondering if there was an easier way to go about this and include the function to count the number of cars that overlap.
A B C D
Arvl Lot Location Arvl Time Dept TimeIs Overnight
xxx15:2516:10FALSE
xxx21:1022:15FALSE
xxx8:219:19FALSE
xxx11:0811:45FALSE
xxx14:2915:15FALSE
xxx19:5521:20FALSE

<tbody>
</tbody>
 
Last edited by a moderator:
Thanks so much for your help. The formula worked great. However, I do have a follow up question.
A B C D E
Arvl PlaceArvl TimeDept TimeIs OvernightOverlap
xxx8:219:19FALSE0
xxx11:0811:45FALSE0
xxx14:2915:15FALSE0
xxx15:2516:10FALSE0
xxx19:5521:20FALSE1
xxx21:1022:15FALSE1
yyy21:3222:00FALSE
yyy17:3320:00FALSE
yyy19:4220:28FALSE
yyy19:4020:37FALSE
yyy14:4115:16FALSE
yyy17:4918:46FALSE
yyy7:5010:50FALSE
yyy15:5516:40FALSE

<tbody>
</tbody>

Is there a way to write ino the formula for it to be able to distingush the change in coloum A? Meaning the formula would only check overlap times when coloum A is the same? Thanks.

How many different values are there for column A
 
Last edited by a moderator:
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
In total there are 336 different values in column A
 
Upvote 0
How many different values are there for column A

There repeating values as you can see in the table I posted, the repeating values just shows that they are in the same lot. Which means there are 336 different locations...Thanks for your help.
 
Upvote 0
I'm not sure how you want the results. The formula below indicates the number of overlaps for each row.


A
B
C
D
E
1
Arvl Place​
Arvl Time​
Dept Time​
Is Overnight​
Num of Overlaps​
2
xxx​
08:21​
09:19​
FALSE​
0​
3
xxx​
11:08​
11:45​
FALSE​
0​
4
xxx​
14:29​
15:15​
FALSE​
0​
5
xxx​
15:25​
16:10​
FALSE​
0​
6
xxx​
19:55​
21:20​
FALSE​
1​
7
xxx​
21:10​
22:15​
FALSE​
1​
8
yyy​
21:32​
22:00​
FALSE​
0​
9
yyy​
17:33​
20:00​
FALSE​
3​
10
yyy​
19:42​
20:28​
FALSE​
2​
11
yyy
19:40​
20:37​
FALSE​
2​
12
yyy​
14:41​
15:16​
FALSE​
0​
13
yyy​
17:49​
18:46​
FALSE​
1​
14
yyy​
07:50​
10:50​
FALSE​
0​
15
yyy​
15:55​
16:40​
FALSE​
0​
16

<tbody>
</tbody>


Formula in E2 copied down
=SUMPRODUCT(--(ROW(A$2:A$400)<>ROW(A2)),--(A$2:A$400=A2),--(A$2:A$400<>""),--(D$2:D$400=FALSE),1-((B2>C$2:C$400)+(B$2:B$400>C2)))

Hope this helps

M.
 
Last edited by a moderator:
Upvote 0
I'm not sure how you want the results. The formula below indicates the number of overlaps for each row.

Formula in E2 copied down
=SUMPRODUCT(--(ROW(A$2:A$400)<>ROW(A2)),--(A$2:A$400=A2),--(A$2:A$400<>""),--(D$2:D$400=FALSE),1-((B2>C$2:C$400)+(B$2:B$400>C2)))

Hope this helps

M.


This does help for the most part, However when it runs into a row where the D colomn is TRUE it returns a negative number instead of disregarding it's data.
 
Last edited by a moderator:
Upvote 0
This does help for the most part, However when it runs into a row where the D colomn is TRUE it returns a negative number instead of disregarding it's data.

Could you show an example where this occurs?

M.
 
Upvote 0
Could you show an example where this occurs?

M.

Column1
A
Column2 BColumn3
C
Column4 DColumn5
E
zzz21:478:43TRUE-36
zzz19:3520:36FALSE5
zzz11:0111:56FALSE4
zzz14:2915:24FALSE6
zzz17:1518:04FALSE3
zzz21:0022:14FALSE2
zzz12:3513:20FALSE3
zzz15:2316:10FALSE8
zzz6:447:34FALSE1
zzz13:3014:15FALSE1
zzz19:0020:00FALSE6
zzz16:1716:57FALSE4
zzz7:388:45FALSE1
zzz11:3612:34FALSE5
zzz19:1120:49FALSE6
zzz9:1710:19FALSE4
zzz16:0416:59FALSE6
zzz17:4118:52FALSE3
zzz6:117:09FALSE1
zzz14:5015:40FALSE5
zzz14:4715:42FALSE5
zzz20:5022:25FALSE2
zzz13:4914:34FALSE3
zzz16:4317:29FALSE6
zzz19:3920:26FALSE5
zzz11:5913:00FALSE5
zzz9:009:40FALSE3
zzz11:3012:50FALSE6
zzz8:579:37FALSE3
zzz22:256:30TRUE-39
zzz19:1720:49FALSE6
zzz20:4421:46FALSE4
zzz15:5417:08FALSE6
zzz14:5015:52FALSE6
zzz14:2015:30FALSE6
zzz18:1319:00FALSE4
zzz15:4417:00FALSE7
zzz16:5918:15FALSE7
zzz11:2312:30FALSE5
zzz10:0011:05FALSE3
zzz18:5320:40FALSE6
zzz19:539:00TRUE-26
zzz8:4510:10FALSE5
zzz12:1013:25FALSE5

<tbody>
</tbody>
 
Last edited by a moderator:
Upvote 0
Try this

E2 copied down
=IF(D2=FALSE,SUMPRODUCT(--(ROW(A$2:A$400)<>ROW(A2)),--(A$2:A$400=A2),--(A$2:A$400<>""),--(D$2:D$400=FALSE),1-((B2>C$2:C$400)+(B$2:B$400>C2))),0)

M.
 
Last edited:
Upvote 0
The negative numbers are gone, thanks. However, I don't quite understand the formula and what exactly the numbers that they calculate mean. Because the numbers seem to be much higher than the actual number of cars overlapping
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,408
Members
449,448
Latest member
Andrew Slatter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top