Grouping overlapping times in MS Excel

BBxcl

New Member
Joined
Sep 29, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a spreadsheet that contains multiple entries each with a start and end time. I want to be able to identify overlapping time entries and then be able to group the overlapping entries by perhaps assigning a Overlap Group ID to pairs of overlapping entries. Start and End Times can be any time during the day. The reason I want to group them is so that I’m able to identify overlapping times in a big dataset, “group” each overlapping time so that I can extract each “group” from the dataset and carry out further calculations on each overlapping “group”.

Please see some sample entries and what I want to obtain in the image below:

EXAC3.png


I have managed to workout the "Overlap Exists" with the following function
Excel Formula:
=IF(SUMPRODUCT((startTime<=endTime)*(endTime>=startTime)),TRUE,FALSE)

However, I’m struggling to determine how to group the two overlapping entries as shown in my example above.

Any help would be greatly appreciated!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
What would you want here?
ID 1 overlaps with ID 2 and ID 2 overlaps with ID 1 and ID 3, but ID 1 and ID 3 do not overlap at all.

21 11 14.xlsm
ABC
1IDStartEnd
219:0012:00
3211:0015:00
4314:0014:30
Overlap
 
Upvote 0
Hmm, in that case I’d want all entries to be extracted. Although, I think using “overlap ID” to group wouldn’t really work very well there so perhaps we could have a dynamic function to show row numbers of overlapping entries and that could generate multiple row numbers?

So in the scenario presented, I would assign row number 2 to ID 1, row numbers 1 and 3 to ID 2 and row number 2 to ID 3.
 
Upvote 0

Forum statistics

Threads
1,223,955
Messages
6,175,605
Members
452,660
Latest member
Zatman

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