Hi all,
I would like to calculate the number of overlapping days between multiple date ranges. This is a set of data for which I want to know how many days a person has supply of all his medications. Below is a sample data, and I would like to know how many days the patient has all 3 of his medications. As the actual data has thousands of rows of data, would be great if there is some formula to handle such data.
Appreciate your help on this!
[TABLE="width: 266"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Drug[/TD]
[TD]Supply start[/TD]
[TD]Supply end[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug A[/TD]
[TD]1/1/10[/TD]
[TD]31/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug A[/TD]
[TD]1/4/10[/TD]
[TD]31/7/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug B[/TD]
[TD]1/1/10[/TD]
[TD]31/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug B[/TD]
[TD]2/5/10[/TD]
[TD]2/6/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]15/1/10[/TD]
[TD]28/1/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]1/2/10[/TD]
[TD]1/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]24/3/10[/TD]
[TD]30/6/10[/TD]
[/TR]
</tbody>[/TABLE]
I would like to calculate the number of overlapping days between multiple date ranges. This is a set of data for which I want to know how many days a person has supply of all his medications. Below is a sample data, and I would like to know how many days the patient has all 3 of his medications. As the actual data has thousands of rows of data, would be great if there is some formula to handle such data.
Appreciate your help on this!
[TABLE="width: 266"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Drug[/TD]
[TD]Supply start[/TD]
[TD]Supply end[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug A[/TD]
[TD]1/1/10[/TD]
[TD]31/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug A[/TD]
[TD]1/4/10[/TD]
[TD]31/7/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug B[/TD]
[TD]1/1/10[/TD]
[TD]31/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug B[/TD]
[TD]2/5/10[/TD]
[TD]2/6/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]15/1/10[/TD]
[TD]28/1/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]1/2/10[/TD]
[TD]1/3/10[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Drug C[/TD]
[TD]24/3/10[/TD]
[TD]30/6/10[/TD]
[/TR]
</tbody>[/TABLE]