Time Overlap

tamtammg

New Member
Joined
Oct 15, 2020
Messages
8
Hi All,

I've tried and tried but couldn't figure this one out...

Attached is a sample data set for employees' Worked hours and Meal breaks at locations on a given date.

I need to figure out if the meal breaks are covered by other working employees. And indicate if the breaks are fully covered (entire time frame), partially covered, or have no coverage (Col G).

I found another post which mentioned Sumproduct would work, but it's not giving me what I needed.

=SUMPRODUCT(--([Location Worked]=[@[Location Worked]]),--([Transaction Date]=[@[Transaction Date]]),([@[Transaction Start Date/Time]]<=[Transaction Start Date/Time])*([@[Transaction End Date/Time]]>=[Transaction End Date/Time]))

Please help!!!

BreakEmployee NameLocation WorkedTransaction DateTransaction Start Date/TimeTransaction End Date/TimeDesired Result
Meal BreakEmployee FLocation B6/20/20206/20/20 2:03 PM6/20/20 3:01 PMPartial Coverage
Worked HoursEmployee FLocation B6/20/20206/20/20 3:00 PM6/20/20 7:00 PM
Worked HoursEmployee HLocation B6/20/20206/20/20 8:50 AM6/20/20 2:30 PM
Worked HoursEmployee ELocation C6/20/20206/20/20 9:00 AM6/20/20 12:00 PM
Worked HoursEmployee ELocation C6/20/20206/20/20 1:00 PM6/20/20 5:58 PM
Meal BreakEmployee ELocation C6/20/20206/20/20 12:00 PM6/20/20 1:00 PMFull Coverage
Worked HoursEmployee GLocation C6/20/20206/20/20 3:46 PM6/20/20 8:56 PM
Worked HoursEmployee GLocation C6/20/20206/20/20 11:17 AM6/20/20 2:46 PM
Meal BreakEmployee GLocation C6/21/20206/21/20 3:05 PM6/21/20 3:26 PMNo Coverage
Worked HoursEmployee GLocation C6/21/20206/21/20 3:26 PM6/21/20 6:13 PM
Worked HoursEmployee GLocation C6/21/20206/21/20 11:04 AM6/21/20 3:05 PM
Meal BreakEmployee BLocation D6/22/20206/22/20 1:48 PM6/22/20 2:55 PMFull Coverage
Worked HoursEmployee BLocation D6/22/20206/22/20 9:31 AM6/22/20 1:48 PM
Worked HoursEmployee BLocation D6/22/20206/22/20 2:55 PM6/22/20 6:11 PM
Worked HoursEmployee HLocation D6/22/20206/22/20 2:04 PM6/22/20 5:08 PM
Worked HoursEmployee HLocation D6/22/20206/22/20 8:38 AM6/22/20 1:04 PM
Worked HoursEmployee ILocation D6/22/20206/22/20 10:05 AM6/22/20 11:57 AM
Worked HoursEmployee ILocation D6/22/20206/22/20 12:56 PM6/22/20 6:33 PM
Worked HoursEmployee LLocation D6/22/20206/22/20 12:30 PM6/22/20 7:30 PM
Worked HoursEmployee LLocation D6/22/20206/22/20 10:00 AM6/22/20 12:00 PM
Worked HoursEmployee NLocation D6/22/20206/22/20 12:35 PM6/22/20 4:56 PM
Worked HoursEmployee NLocation D6/22/20206/22/20 8:55 AM6/22/20 12:05 PM
Worked HoursEmployee OLocation D6/22/20206/22/20 5:53 PM6/22/20 9:03 PM
Worked HoursEmployee OLocation D6/22/20206/22/20 1:02 PM6/22/20 5:00 PM
Worked HoursEmployee PLocation D6/22/20206/22/20 4:33 PM6/22/20 9:04 PM
Worked HoursEmployee PLocation D6/22/20206/22/20 11:13 AM6/22/20 3:30 PM
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
This is not very elegant, but it works for me.
Excel Formula:
=IF([@Break]="Meal Break",IF(SUMIFS([Transaction Start Date/Time],[Break],"Worked Hours",[Location Worked],[@[Location Worked]],[Transaction Start Date/Time],"<"&[@[Transaction Start Date/Time]],[Transaction End Date/Time],">"&[@[Transaction End Date/Time]])>0,"Full Coverage",IF(SUMIFS([Transaction Start Date/Time],[Break],"Worked Hours",[Location Worked],[@[Location Worked]],[Transaction Start Date/Time],"<"&[@[Transaction End Date/Time]],[Transaction End Date/Time],">"&[@[Transaction End Date/Time]])>0,"Partial Coverage","No Coverage")),"")
 
Upvote 0
Solution
This is not very elegant, but it works for me.
Excel Formula:
=IF([@Break]="Meal Break",IF(SUMIFS([Transaction Start Date/Time],[Break],"Worked Hours",[Location Worked],[@[Location Worked]],[Transaction Start Date/Time],"<"&[@[Transaction Start Date/Time]],[Transaction End Date/Time],">"&[@[Transaction End Date/Time]])>0,"Full Coverage",IF(SUMIFS([Transaction Start Date/Time],[Break],"Worked Hours",[Location Worked],[@[Location Worked]],[Transaction Start Date/Time],"<"&[@[Transaction End Date/Time]],[Transaction End Date/Time],">"&[@[Transaction End Date/Time]])>0,"Partial Coverage","No Coverage")),"")
You're a genius! This works! Thank you!!!❤️
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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