Share via

How to check overlapping days and times

Anonymous
2013-05-15T01:39:41+00:00

Hi,

I am looking for help to see if there is a simple way to check the following…

1.    If any Date are the same.

2.    If there are any Start Times the same.

3.    If there are any End Times the same.

4.    If there are any Times that Overlap.

5.    Tell me the total Number of Times that Overlap.

The Formula’s I have for the above…

1.    In Cell D3: @IF(A2=A3,“Yes”,“No”)

2.    In Cell E3: @IF(B2=B3,“Yes”,“No”)

3.    In Cell F3: @IF(C2=C3,“Yes”,“No”)

4.    In Cell G3: <I don’t know, and need help>

5.    In Cell H3: <I don’t know, and need help>

6.    In Cell I3: <I don’t know, and need help>

What I am trying to do…

I am trying to work out a video list, with the Date, Start Time and End Time (Times can overlap 2 days, i.e. 11pm to 1am) of a Programme that I wish to record, but I only have 3 Recorders, so I need to know if I have more than 3 Programmes on at the same time, so that I know that I need to find another showing of the 4^th^ Programme so that I will not miss any Programmes.

I have shown with Rows 8, 9, 10 and 11 all overlap, so I need to know this so that I can look to see if any of the Programmes in those 4 Rows are on later.

I need to know, so that I can have a message to let me know if I have any Overlaps encase I don’t see it as I enter the programme.

<br>**** <br>A <br>B <br>C <br>D <br>E <br>F <br>G <br>H <br>I
<br>1 <br>Date <br>Start Time <br>End Time <br>Same Day <br>Same Start Time <br>Same End Time <br>Times Overlap <br>Overlaps <br>Total Overlaps
<br>2 <br>11 May 2013 <br>1:59 pm <br>6:05 pm <br> <br> <br> <br> <br> <br>
<br>3 <br>11 May 2013 <br>5:00 pm <br>7:30 pm <br>Yes <br>No <br>No <br>Yes <br>1 <br>2
<br>4 <br>11 May 2013 <br>11:29 pm <br>4:30 am <br>Yes <br>No <br>No <br>Yes <br>2 <br>2
<br>5 <br>12 May 2013 <br>2:59 am <br>8:00 am <br>No <br>No <br>No <br>Yes <br>2 <br>2
<br>6 <br>12 May 2013 <br>9:59 am <br>3:05 pm <br>Yes <br>No <br>No <br>No <br>0 <br>0
<br>7 <br>12 May 2013 <br>10:59 pm <br>12:05 am <br>Yes <br>No <br>No <br>No <br>0 <br>0
<br>8 <br>13 May 2013 <br>9:45 pm <br>1:50 am <br>No <br>No <br>No <br>Yes <br>3 <br>4
<br>9 <br>13 May 2013 <br>10:00 pm <br>12:15 am <br>Yes <br>No <br>No <br>Yes <br>3 <br>4
<br>10 <br>13 May 2013 <br>11:55 pm <br>2:05 am <br>Yes <br>No <br>No <br>Yes <br>3 <br>4
<br>11 <br>14 May 2013 <br>12:10 am <br>2:20 am <br>No <br>No <br>No <br>Yes <br>3 <br>4

Thank you in advance for your help,

Neil

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2013-05-24T14:08:38+00:00

    Sorry, but as far as I am concerned my formula reports the total number of overlaps with the current row which is what you wanted to know, using just date+time values. 

    Your intermediate steps would appear to make the problem harder rather than easier.

    You really only need the following coloumns:

    Date

    Start time

    End time

    Start date+time = IF(Date<>"",Date+StartTime,"")

    End date+time =IF(Date<>"",Date+EndTime+IF(EndTime<StartTime,1,0))

    Overlaps = my formula

    If Overlaps>3 you have a problem to solve; otherwise you don't.

    Can I just leave you with that?

    0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-05-16T02:53:43+00:00

    Hi Bill,

    I have sorted out how to add the correct date and time together using the above.

    My Start Date + Start Time is in Cells "CJ17:CJ216"

    My End Date + End Time is in Cells "CN17:CN216"

    The formula for working out is... {=IF(CU17="Yes",SUM((CJ17<CN$17:CN$216)*(CN17<CJ$17:CJ$216)),"")}

    But for some reason I am getting the following... 163 from the above formulas.

    What I want is for it to do the following...

    If 1 Programme, do not overlap, then do nothing.

    If 2 Programmes, do nothing, OK with 2 overlap.

    If 3 Programmes, do nothing, OK with 3 overlap.

    If 4 or more Programmes, "Error, Too Many Overlapping Programmes"

    I am not sure why it is not working as I have the column for each of the Items that you have said in your last message.

    Can you see by looking at the information I've said above about where the dates are and the formula for working out the overlaps?

    Thank you,

    Neil

    0 comments No comments
  2. Anonymous
    2013-05-15T23:18:39+00:00

    I don't think you need the formulas in CL to CP for the purpose of determining the number of overlaps:

    In CL (Start Date+Time) put =CH17+CI17

    In CM (End Date+Time) put =CH17+CJ17+IF(CJ17<CI17,1,0)

    In CN (Number of overlaps) put =SUM((CL17<CM$17:CM$216)*(CM17<CL$17:CL$216))

      and enter the last with Ctrl+Shift+Enter so that it is an array formula

    Fill these 3 formulas down to row 216

    0 comments No comments
  3. Anonymous
    2013-05-15T23:10:12+00:00

    Hi Bill,

    Thank you for your reply.

    I have a problem to add the date to the start time and end time.

    When I first created the worksheet I don't really use dates with times.

    I only really used the date to sort the list into date order.

    I have a lookup table with the dates for the week, This is a copy of how the lookup table looks...

    Day                    Date

    Saturday            11/05/2013

    Sunday              12/05/2013

    Monday            13/05/2013

    Tuesday            14/05/2013

    Wednesday      15/05/2013

    Thursday          16/05/2013

    Friday               17/05/2013

    Saturday          18/05/2013

    I then enter the day, and then the following formula I use to insert the date in my table

    =IF(B17="","",$L$16+IF(E17="Sat",0,IF(E17="Sun",1,IF(E17="Mon",2,IF(E17="Tue",3,IF(E17="Wed",4,IF(E17="Thu",5,IF(E17="Fri",6,IF(E17="Next",7,0)))))))))

    I use the following formula to correct the end time if goes over midnight

    =IF(H17<>"",IF(HOUR(X17)<12,X17+(12*60)+MINUTE(X17),X17)," ")

    So I am not sure how I would add the date to both start and end times.

    To add the date to the start time, I would guess that the formula would be...

    date+start time

    but how would I add the date to the end time?

    Just to let you know I've copied the date, start time and end time to a new area of the sheet just to work out if the times overlap, here are the cell ref for this new area...

    Date = CH17:CH216

    Start Time = CI17:CI216

    End Time = CJ17:CJ216

    I have also set the following to show working out and information I may need to know...

    Day of Week = CG17:CG216

    Code for information = CK17:CK216

    Same Date = CL17:CL216 Formula: =IF(CH17<>"",IF(CH17=CH16,"Yes","No"),"")

    Same Start Time = CM17CM216 Formula =IF(CH17<>"",IF(CI17=CI16,"Yes","No"),"")

    Same End Time = CN17:CN216 Formula =IF(CH17<>"",IF(CJ17=CJ16,"Yes","No"),"")

    Start Time Before End Time = CO17:CO216 Formula =IF(CH17<>"",IF(CI17<CJ16,"Yes","No"),"")

    Need to Check for Overlap = CP17:CP216 Formula =IF(CH17<>"",IF(OR(CK17="Y",CK17="A"),"Yes","No"),"")

    Can I use a formula to check for overlaps with the details within this new table.

    Can add new items to the table, i.e. can add a column for end date, then a column for start date + start time, then a column end date + end time.

    Then use the formula you gave in your first reply.

    Neil

    0 comments No comments
  4. Anonymous
    2013-05-15T07:38:11+00:00

    I think it would be easier if you held the start and end times as date+time values.

    That way there would be no correction needed for recordings that go over midnight.

    I will assume that the values in B and C are changed to be such date+time values

    Times overlap if the Start of A is less than the End of B AND the Start of B is less than the End of A

    So the number of recordings that overlap with the one in row 2 is:

    =SUM((B2<C$2:C$1000)*(C2<B$2:B$1000))

    entered using Ctrl+Shift+Enter. 

    I have assumed there are not more than 1000 rows - adjust as necessary.

    0 comments No comments