Identify Overlapping Times with Multiple Criteria

DMDGUSA

New Member
Joined
Mar 26, 2019
Messages
6
I've been struggling to find a way to identify pairs of entries for which at least of portion of their time overlaps. To make the challenge more difficult, I need potentially overlapping entries to meet multiple criteria before they are determined to be overlapping.

I have two fields for identifying overlapping entries. One is an "Has Overlap" field which should simply return TRUE or FALSE if an entry shares a time overlap with another entry and meets all the criteria. In the second field, for every pair of entries which overlap and meet the multiple criteria, I need each entry in the pair to be give a common Overlap Group Identification.

I NEED FUNCTIONS WHICH CAN RETURN THE RESULTS WHICH ARE DISPLAYED IN THE EXAMPLE BELOW FOR THE "HAS OVERLAP" FIELD AND THE "OVERLAP GROUP ID" FIELD.

Below is an example of the sheet I'm working on. I have an example which I can attached (if allowed) so it's easier to understand than a big explanation. I've seen some similar posts regarding time overlaps, but none with this multi-criteria requirement. I successfully used the SUMPRODUCT function to identify one overlapping entry in a pair of overlapping entries, but I couldn't get it to identify both entries in the overlapping pair.

Hopefully someone can help me better understand how to accomplish this identification of overlapping times, and better understand the SUMPRODUCT function. If there is a better function to use, I'm all ears.

Thanks for the ideas.

EXAMPLE:
EmployeeCustomerTaskBillable TaskStart DateStart Date TimeEnd Date TimeHas OverlapOverlap Group IDExplanation
10Employee ACustomer 01Task 1TRUE3/26/20193/26/19 9:00 AM3/26/19 10:00 AMTRUEOverlap 01"The ""Has Overlap"" field is TRUE because this entry overlaps the entry on row 11 since the same employee has two entries which share the same 30 minute timeframe from 9:30 AM to 10:00 AM. Both overlapping entries have a Billable Task field value of TRUE, so they are recognized as overlaps.


The entry is given a Overlap Group ID of 1 because it is the first overlapping entry for any employee or customer."
11Employee ACustomer 02Task 1TRUE3/26/20193/26/19 9:30 AM3/26/19 11:00 AMTRUE
Overlap 01

<tbody>
</tbody>
"The ""Has Overlap"" field is TRUE because this entry overlaps the entry on row 10 since the same employee has two entries which share the same 30 minute timeframe from 9:30 AM to 10:00 AM. Both overlapping entries have a Billable Task field value of TRUE, so they are recognized as overlaps.


This entry is given an Overlap Group ID which matches that in row 10 because it is not the first of the overlapping entries which share this same timeframe for this employee or customer."
12Employee ACustomer 02Task 2FALSE3/26/20193/26/19 9:30 AM3/26/19 11:00 AMFALSEThough this entry overlaps two other entries in row 10 and 11, it DOES NOT have a "Billable Task" of TRUE and thus it does not represent an overlapping entry. So the "Has Overlap" field is FALSE.
13Employee ACustomer 04Task 1TRUE3/26/20193/26/19 11:00 AM3/26/19 12:00 PMFALSEThe "Has Overlap" field is FALSE because no other entry share this timeframe.
14Employee ACustomer 05Task 1TRUE3/26/20193/26/19 12:00 PM3/26/19 1:00 PMTRUEOverlap 02"The ""Has Overlap"" field is TRUE because this entry overlaps the entry on row 15 since the same customer has two entries which share the same 30 minute timeframe from 12:30 PM to 1:00 PM. Both overlapping entries have a Billable Task field value of TRUE, so they are recognized as overlaps.


The entry is given a Overlap Group ID of 2 because this is the second group of entries which share an overlapping timeframe."
15Employee BCustomer 05Task 1TRUE3/26/20193/26/19 12:30 PM3/26/19 1:30 PMTRUEOverlap 02"The ""Has Overlap"" field is TRUE because this entry overlaps the entry on row 14 since the same customer has two entries which share the same 30 minute timeframe from 12:30 PM to 1:00 PM. Both overlapping entries have a Billable Task field value of TRUE, so they are recognized as overlaps.


This entry is given an Overlap Group ID which matches that in row 14 because it is not the first of the overlapping entries which share this same timeframe for this employee or customer."
16Employee BCustomer 07Task 1TRUE3/26/20193/26/19 10:00 AM3/26/19 11:00 AMFALSEThe "Has Overlap" field is FALSE because No other entry with a "Billable Task" status share the same customer or same employee, and same timeframe.

<tbody>
</tbody>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Now, the explanation goes:
Complete formula

=IF(SUMPRODUCT(
(ROW(D2)<>ROW($D$2:$D$8))*

(D2="TRUE")*
($D$2:$D$8="TRUE")*
(($F$2:$F$8<(F2+0.0006))*($G$2:$G$8>F2)+($F$2:$F$8<G2)*($G$2:$G$8>(G2-0.0006))>0)*
(($A$2:$A$8=A2)+($B$2:$B$8=B2)>0))>0,"TRUE","FALSE")



= IF (SUMPRODUCT (
(ROW(D2) <> ROW ($D$2:$D$8))
Only check the rows different to D2, that is, it does not compare itself, since the result would be true.


* (D2=TRUE) *
Only check if "Billable Task" is TRUE, as in the case of row 4, it is FALSE, then it does not perform the comparison.


($D$2:$D$8=TRUE) *
Only compare with the other rows if "Billable Task" equals TRUE


(($F$2:$F$8 <(F2 + 0.0006)) * ($ G $ 2: $ G $ 8> F2)
If the range of startDate is less than my startDate and the range of endDate is greater than my startDate.
F2 + 0.00006 means 9:00 + one minute = 9:01, without this, if you compare a range of 8 to 9 against 9 to 10 it would be true, that's why I increase it by one minute


+ (this is important, it is to ask if the previous match is met or if the following condition is met)


($F$2:$F$8<g2) *="" ($g$2:$g$8=""> (G2-0.0006))> 0) *
Compare the final date with the date ranges


(
($A$2:$A$8 = A2)
If the employee matches
+
Or if the customer matches
($B$2:$B$8 = B2)> 0)


)> 0, TRUE, FALSE)
If all the conditions are met it will result in> 0 then TRUE, if any condition is not met, then the result is 0 (FALSE)


</g2)><g2) *="" ($g$2:$g$8="">I have problems to solve formula 2


</g2)>
Sorry I know this is an old thread, and you might not see this, but I am having difficulties setting up a formula using your example. I am needing to see if there is an overlap in services that have the status of Kept, but right now using your formula it is returning TRUE for every service that is Kept regardless if there is an overlap or not. I am also not quite sure how to have the Service date included so it will ignore overlapping times from different days.
The formula used without accounting for date at the moment: =IF(SUMPRODUCT((ROW(F2)<>ROW($F$2:$F$3000))*(F2="Kept")*($F$2:$F$3000="Kept")*(($C$2:$C$3000<(C2+0.0006))*($D$2:$D$3000>C2)+($C$2:$C$3000)*($D$2:$D$3000>(D2-0.0006))>0)*(($A$2:$A$3000=A2)>0))>0,"TRUE","FALSE")
ClientService DateBegin TimeEnd TimeMinutesStatusTypeActivityProcedureUnitsStaffProgramOrg CodeBilling StatusHas Overlap
Test, Client (9999) 12/31/200006/04/202312:00 AM12:01 AM1KeptClientPT11Test, StaffPT1PTSTRUE
Test, Client (9999) 12/31/200006/04/202309:00 AM10:00 AM60ErrorGroupPTGS0Test, StaffPT1PTSFALSE
Test, Client (9999) 12/31/200006/04/202301:00 PM02:00 PM60KeptGroupPTGS0Test, StaffPT1PTSTRUE
Test, Client (9999) 12/31/200006/04/20231:30 PM04:00 PM120KeptGroupPTGS0Test, StaffPT1PTSTRUE
Test, Client (9999) 12/31/200006/04/202303:00 PM04:00 PM60KeptClientPTIF0Test, StaffPT1PTSTRUE
Test, Client (9999) 12/31/200006/04/202307:30 PM08:00 PM30KeptGroupPTGS0Test, StaffPT1PTSTRUE
 
Upvote 0
Hi @nmk7
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

I am also not quite sure how to have the Service date included so it will ignore overlapping times from different days.


I suggest you create two columns with the sum of the date and time, see the following example:

varios 12jun2023.xlsm
ABCDEFGHQ
1ClientService DateBegin TimeEnd TimeBegin TimeEnd TimeMinutesStatusHas Overlap
2Test, Client (9999) 12/31/200006/04/202312:00:00 a. m.12:01:00 a. m.06/04/2023 00:0006/04/2023 00:011KeptFALSE
3Test, Client (9999) 12/31/200006/04/202309:00:00 a. m.10:00:00 a. m.06/04/2023 09:0006/04/2023 10:0060ErrorFALSE
4Test, Client (9999) 12/31/200006/04/202301:00:00 p. m.02:00:00 p. m.06/04/2023 13:0006/04/2023 14:0060KeptTRUE
5Test, Client (9999) 12/31/200006/04/202301:30:00 p. m.04:00:00 p. m.06/04/2023 13:3006/04/2023 16:00120KeptTRUE
6Test, Client (9999) 12/31/200006/04/202303:00:00 p. m.04:00:00 p. m.06/04/2023 15:0006/04/2023 16:0060KeptTRUE
7Test, Client (9999) 12/31/200006/04/202307:30:00 p. m.08:00:00 p. m.06/04/2023 19:3006/04/2023 20:0030KeptFALSE
Hoja1
Cell Formulas
RangeFormula
E2:F7E2=$B2+LEFT(C2,8)
Q2:Q7Q2=IF(SUMPRODUCT((ROW(F2)<>ROW($F$2:$F$7))*($H$2:$H$7="Kept")* (($E$2:$E$7<(E2+0.0006))*($F$2:$F$7>E2)+($E$2:$E$7<F2)*($F$2:$F$7>(F2-0.0006))>0)* (($A$2:$A$7=A2)>0))>0,"TRUE","FALSE")



--------------
If it's not what you need, I suggest creating a new thread.
Cordially
Dante Amor
--------------​
 
Upvote 0
Hi @nmk7
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.




I suggest you create two columns with the sum of the date and time, see the following example:

varios 12jun2023.xlsm
ABCDEFGHQ
1ClientService DateBegin TimeEnd TimeBegin TimeEnd TimeMinutesStatusHas Overlap
2Test, Client (9999) 12/31/200006/04/202312:00:00 a. m.12:01:00 a. m.06/04/2023 00:0006/04/2023 00:011KeptFALSE
3Test, Client (9999) 12/31/200006/04/202309:00:00 a. m.10:00:00 a. m.06/04/2023 09:0006/04/2023 10:0060ErrorFALSE
4Test, Client (9999) 12/31/200006/04/202301:00:00 p. m.02:00:00 p. m.06/04/2023 13:0006/04/2023 14:0060KeptTRUE
5Test, Client (9999) 12/31/200006/04/202301:30:00 p. m.04:00:00 p. m.06/04/2023 13:3006/04/2023 16:00120KeptTRUE
6Test, Client (9999) 12/31/200006/04/202303:00:00 p. m.04:00:00 p. m.06/04/2023 15:0006/04/2023 16:0060KeptTRUE
7Test, Client (9999) 12/31/200006/04/202307:30:00 p. m.08:00:00 p. m.06/04/2023 19:3006/04/2023 20:0030KeptFALSE
Hoja1
Cell Formulas
RangeFormula
E2:F7E2=$B2+LEFT(C2,8)
Q2:Q7Q2=IF(SUMPRODUCT((ROW(F2)<>ROW($F$2:$F$7))*($H$2:$H$7="Kept")* (($E$2:$E$7<(E2+0.0006))*($F$2:$F$7>E2)+($E$2:$E$7<F2)*($F$2:$F$7>(F2-0.0006))>0)* (($A$2:$A$7=A2)>0))>0,"TRUE","FALSE")



--------------
If it's not what you need, I suggest creating a new thread.
Cordially
Dante Amor
--------------​
It's working better, but it is still treating overlaps of time with the Status of Kept and Error as a TRUE when all instances of ERROR should come back as FALSE (See bottom row of table below). Our system outputs reports as excel spreadsheets, so I'm building a template that I can just copy and paste the info into to check for overlaps over the last week of services for a particular set of clients, that's why there's all the extra columns of info that is useless for the task at hand.

Formula used: =IF(SUMPRODUCT((ROW(P2)<>ROW($P$2:$P$3000))*($F$2:$F$3000="Kept")*(($O$2:$O$3000<(O2+0.0006))*($P$2:$P$3000>O2)+($O$2:$O$3000<P2)*($P$2:$P$3000>(P2-0.0006))>0)*(($A$2:$A$3000=A2)>0))>0,"TRUE","FALSE")

ClientService DateBegin TimeEnd TimeMinutesStatusTypeActivityProcedureUnitsStaffProgramOrg CodeBilling StatusDate + Begin TimeDate + End TimeHas Overlap
Test, Client (9999) 12/31/200006/04/202312:00 AM12:01 AM1KeptClientPT11Test, StaffPT1PTS6/4/23 0:006/4/23 0:01FALSE
Test, Client (9999) 12/31/200006/04/202309:00 AM10:00 AM60ErrorGroupPTGS0Test, StaffPT1PTS6/4/23 9:006/4/23 10:00FALSE
Test, Client (9999) 12/31/200006/04/202301:00 PM02:00 PM60KeptGroupPTGS0Test, StaffPT1PTS6/4/23 13:006/4/23 14:00TRUE
Test, Client (9999) 12/31/200006/04/202301:00 PM04:00 PM120KeptGroupPTGS0Test, StaffPT1PTS6/4/23 13:006/4/23 16:00TRUE
Test, Client (9999) 12/31/200006/04/202303:00 PM04:00 PM60KeptClientPTIF0Test, StaffPT1PTS6/4/23 15:006/4/23 16:00TRUE
Test, Client (9999) 12/31/200006/04/202307:30 PM08:00 PM30KeptGroupPTGS0Test, StaffPT1PTS6/4/23 19:306/4/23 20:00FALSE
Test, Client (9999) 12/31/200006/04/202308:00 PM08:30 PM30ErrorGroupMRUN0Test, StaffPT1BH6/4/23 20:006/4/23 20:30FALSE
Test, Client (9999) 12/31/200006/05/202312:00 AM12:01 AM1KeptClientPT11Test, StaffPT1PTS6/5/23 0:006/5/23 0:01FALSE
Test, Client (9999) 12/31/200006/05/202309:00 AM10:00 AM60ErrorGroupPTGS0Test, StaffPT1PTS6/5/23 9:006/5/23 10:00TRUE
 
Upvote 0
Hi @nmk7
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.




I suggest you create two columns with the sum of the date and time, see the following example:

varios 12jun2023.xlsm
ABCDEFGHQ
1ClientService DateBegin TimeEnd TimeBegin TimeEnd TimeMinutesStatusHas Overlap
2Test, Client (9999) 12/31/200006/04/202312:00:00 a. m.12:01:00 a. m.06/04/2023 00:0006/04/2023 00:011KeptFALSE
3Test, Client (9999) 12/31/200006/04/202309:00:00 a. m.10:00:00 a. m.06/04/2023 09:0006/04/2023 10:0060ErrorFALSE
4Test, Client (9999) 12/31/200006/04/202301:00:00 p. m.02:00:00 p. m.06/04/2023 13:0006/04/2023 14:0060KeptTRUE
5Test, Client (9999) 12/31/200006/04/202301:30:00 p. m.04:00:00 p. m.06/04/2023 13:3006/04/2023 16:00120KeptTRUE
6Test, Client (9999) 12/31/200006/04/202303:00:00 p. m.04:00:00 p. m.06/04/2023 15:0006/04/2023 16:0060KeptTRUE
7Test, Client (9999) 12/31/200006/04/202307:30:00 p. m.08:00:00 p. m.06/04/2023 19:3006/04/2023 20:0030KeptFALSE
Hoja1
Cell Formulas
RangeFormula
E2:F7E2=$B2+LEFT(C2,8)
Q2:Q7Q2=IF(SUMPRODUCT((ROW(F2)<>ROW($F$2:$F$7))*($H$2:$H$7="Kept")* (($E$2:$E$7<(E2+0.0006))*($F$2:$F$7>E2)+($E$2:$E$7<F2)*($F$2:$F$7>(F2-0.0006))>0)* (($A$2:$A$7=A2)>0))>0,"TRUE","FALSE")



--------------
If it's not what you need, I suggest creating a new thread.
Cordially
Dante Amor
--------------​
I just realized I didn't include the row that would be needed to troubleshoot the problem. It's the last two rows:

ClientService DateBegin TimeEnd TimeMinutesStatusTypeActivityProcedureUnitsStaffProgramOrg CodeBilling StatusDate + Begin TimeDate + End TimeHas Overlap
Test, Client (9999) 12/31/200006/04/202312:00 AM12:01 AM1KeptClientPT11Test, StaffPT1PTS6/4/23 0:006/4/23 0:01FALSE
Test, Client (9999) 12/31/200006/04/202309:00 AM10:00 AM60ErrorGroupPTGS0Test, StaffPT1PTS6/4/23 9:006/4/23 10:00FALSE
Test, Client (9999) 12/31/200006/04/202301:00 PM02:00 PM60KeptGroupPTGS0Test, StaffPT1PTS6/4/23 13:006/4/23 14:00TRUE
Test, Client (9999) 12/31/200006/04/202301:00 PM04:00 PM120KeptGroupPTGS0Test, StaffPT1PTS6/4/23 13:006/4/23 16:00TRUE
Test, Client (9999) 12/31/200006/04/202303:00 PM04:00 PM60KeptClientPTIF0Test, StaffPT1PTS6/4/23 15:006/4/23 16:00TRUE
Test, Client (9999) 12/31/200006/04/202307:30 PM08:00 PM30KeptGroupPTGS0Test, StaffPT1PTS6/4/23 19:306/4/23 20:00FALSE
Test, Client (9999) 12/31/200006/04/202308:00 PM08:30 PM30ErrorGroupMRUN0Test, StaffPT1BH6/4/23 20:006/4/23 20:30FALSE
Test, Client (9999) 12/31/200006/05/202312:00 AM12:01 AM1KeptClientPT11Test, StaffPT1PTS6/5/23 0:006/5/23 0:01FALSE
Test, Client (9999) 12/31/200006/05/202309:00 AM10:00 AM60ErrorGroupPTGS0Test, StaffPT1PTS6/5/23 9:006/5/23 10:00TRUE
Test, Client (9999) 12/31/200006/05/202309:00 AM10:00 AM60KeptGroupPTGS0Test, StaffPT1PTS6/5/23 9:006/5/23 10:00FALSE
 
Upvote 0
Hi @nmk7
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.




I suggest you create two columns with the sum of the date and time, see the following example:

varios 12jun2023.xlsm
ABCDEFGHQ
1ClientService DateBegin TimeEnd TimeBegin TimeEnd TimeMinutesStatusHas Overlap
2Test, Client (9999) 12/31/200006/04/202312:00:00 a. m.12:01:00 a. m.06/04/2023 00:0006/04/2023 00:011KeptFALSE
3Test, Client (9999) 12/31/200006/04/202309:00:00 a. m.10:00:00 a. m.06/04/2023 09:0006/04/2023 10:0060ErrorFALSE
4Test, Client (9999) 12/31/200006/04/202301:00:00 p. m.02:00:00 p. m.06/04/2023 13:0006/04/2023 14:0060KeptTRUE
5Test, Client (9999) 12/31/200006/04/202301:30:00 p. m.04:00:00 p. m.06/04/2023 13:3006/04/2023 16:00120KeptTRUE
6Test, Client (9999) 12/31/200006/04/202303:00:00 p. m.04:00:00 p. m.06/04/2023 15:0006/04/2023 16:0060KeptTRUE
7Test, Client (9999) 12/31/200006/04/202307:30:00 p. m.08:00:00 p. m.06/04/2023 19:3006/04/2023 20:0030KeptFALSE
Hoja1
Cell Formulas
RangeFormula
E2:F7E2=$B2+LEFT(C2,8)
Q2:Q7Q2=IF(SUMPRODUCT((ROW(F2)<>ROW($F$2:$F$7))*($H$2:$H$7="Kept")* (($E$2:$E$7<(E2+0.0006))*($F$2:$F$7>E2)+($E$2:$E$7<F2)*($F$2:$F$7>(F2-0.0006))>0)* (($A$2:$A$7=A2)>0))>0,"TRUE","FALSE")



--------------
If it's not what you need, I suggest creating a new thread.
Cordially
Dante Amor
--------------​
Hello,

Sorry for all the messages about this, but I can't quite figure this out. I'm working on this project some more this morning, and the formula is treating all overlaps of clients as a True event. I'm not needing to see if client #1 and client #2 have overlapping services. Just checking to see if each individual client is being billed by multiple staff at one time. So the outcome of the table below should be True, False, True, False. So in this scenario Staff member Jane ran a group session with clients #1-3, and John supposedly ran an individual session with client #1.

Formula used: =IF(SUMPRODUCT((ROW(P5)<>ROW($P$2:$P$2999))*(F5="Kept")*($F$2:$F$2999="Kept")*(($O$2:$O$2999<(O5+0.0006))*($P$2:$P$2999>O5)+($O$2:$O$2999<P5)*($P$2:$P$2999>(P5-0.0006))>0)*(($A$2:$A$2999=A5)>0))>0,"True","FALSE")

Any guidance you can give?

ClientService DateBegin TimeEnd TimeMinutesStatusTypeActivityProcedureUnitsStaffProgramOrg CodeBilling StatusDate + Begin TimeDate + End TimeHas Overlap
Test, Client (0001) 1/1/200105/26/202308:00 AM09:00 AM60KeptGroupPTGTest, JanePTPTR5/26/23 8:005/26/23 9:00True
Test, Client (0002) 2/2/200205/26/202308:00 AM09:00 AM60KeptGroupPTGTest, JanePTPTR5/26/23 8:005/26/23 9:00True
Test, Client (0001) 1/1/200105/26/202308:00 AM09:00 AM60KeptGroupPTITest, JohnPTPTR5/26/23 8:005/26/23 9:00True
Test, Client (0003) 3/3/200305/26/202308:00 AM09:00 AM61KeptGroupPTGTest, JanePTPTR5/26/23 8:005/26/23 9:00True
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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