Count overlapping months from date ranges

jasonnj1978pwest

New Member
Joined
Oct 18, 2017
Messages
10
Hi everyone,

Longtime browser of site and this is my first post!!

So I've been struggling with finding a formula that will help me count how many months are overlapping between more than 2 date ranges. Below is a sample of that data I am working with.


I was able to find a formula that would tell me what date spans were overlapping:
Cell H2: =IF(SUMPRODUCT(--(A:A=A2)*--(F:F<G2)*--(G:G>F2))>1,"Overlapping","")

I thought I could use that to then use a formula that would evaluate all the dates and tell me how many months of overlap there are. In this example I would expect 9 months of overlap.

If anyone can help with this I'd greatly appreciate it!!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How do you want to handle partial months? if the overlapping time is from March 20th to June 10th, do you want to see 4 months overlap to include each partial month as a full month or do you want to see 2 for only full partial months? Are you only evaluating 2 date ranges?
 
Upvote 0
Thank you for the reply aaronbens.

Here are the answers to your questions:

1. If there is 1 day or greater overlap then round up to consider it 1 month. I'd want to see 4 months in your example.
2. There are 2 date ranges, an eff_date column and and end_date column. There are several rows of date spans for each unique person_id in my data and the data is sorted by that unique person_id and then by the end_date in ascending order i.e., oldest end date to newest end date.

I tried to post a picture of a small data set example and to attach an excel file of that but I don't have permissions for attachements.
 
Upvote 0
So unique person#1 could have 5 or 10 date ranges listed? If so, you want the sum of the overlap of all the ranges?
 
Upvote 0
ABCDEFGH
1PRIMARY_IDID_1ID_2FIRSTNAMELASTNAMEEFF_DATEEND_DATEOVERLAPPING
2012345677654321001234567JANEDOE11/1/201311/30/2013
3012345670123456776543210JANEDOE9/1/20143/31/2015
4012345677654321001234567JANEDOE3/1/20164/30/2016
5012345670123456776543210JANEDOE1/1/20172/28/2017YES
6012345670123456776543210JANEDOE3/1/20179/30/2017YES
7012345677654321001234567JANEDOE5/1/201610/31/2017YES

<tbody>
</tbody>

****** id="cke_pastebin" style="position: absolute; top: 84px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
01234567

<tbody>
</tbody>
</body>












Sample data of what I'm working with.
 
Upvote 0
Sorry for all the questions. You said you would expect 9 months of overlap, but I only see the last 2 rows as having any overlap and I count 5 months (May, June, July, August, September). Row 5 ends the day before row 6 starts. Am I reading it wrong?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,037
Members
449,062
Latest member
mike575

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