# Identify overlapping date ranges

This article demonstrates formulas that show if a date range is overlapping another date range. The second section shows how to identify overlapping date ranges based on a condition.

**Table of Contents**

## 1. Identify overlapping date ranges

The formula in cell F6 returns TRUE if the date range on the same row overlaps another date range in cell range C6:D12.

Formula in cell F6:

Copy cell E6 and paste it down as far as needed.

If there are multiple overlapping date range it can be quite hard to identify which date range overlaps, I made an article that assists you in finding overlapping date ranges.

There is also a formula for counting overlapping days: Counting overlapping days

Here is a picture of the date ranges. Jeff's and Shaun's date ranges overlap.

If you are interested in a formula that creates a schedule based on date ranges, like the one above, read the following article: Visualize date ranges in a calendar

### Explaining formula in cell F6

I am using date values in this worksheet and Excel handles dates as numbers if you don't know that. For example, 1/1/1900 is 1. 1/1/2018 is 43101.

You can verify this by typing 1/1/1900 in a cell and then press Enter. Select the cell containing the date and press and hold CTRL, then press 1. This opens the "Format Cell" dialog box, here you can change the

#### Step 1 - Check if start date is less than or equal to end dates

The less than and equal sign allows you to build a logical expression that returns a boolean value.

A boolean value is either TRUE or FALSE. In this case, the expression returns an array of value since we are comparing one date value with multiple date values.

returns

{TRUE; ... ; TRUE}. See the image to the right.

Note that C6 is a relative cell reference that changes when the formula is copied to the cells below. (Actually you copy the cell and paste to the cells below.)

$D$6:$D$12 is an absolute cell reference meaning it won't change when you copy the cell and paste to cells below. Read more: How to use absolute and relative references

#### Step 2 - Check if end date is larger than or equal to start dates

The next logical expression is somewhat similar to the first one except that now we compare if the end date is larger or equal to the start dates.

returns an array displayed in the image to the right.

#### Step 3 - Multiply arrays

This step multiplies the arrays, this means AND logic between values on the same row.

(C6<=$D$6:$D$12)*(D6>=$C$6:$C$12)

returns an array displayed in the image to the right.

The parentheses are necessary so the logical operators are performed first and then arrays being multiplied.

Multiplying arrays containing boolean values converts them into their numerical counterparts. TRUE = 1 and FALSE = 0.

TRUE * TRUE = 1

TRUE * FALSE = 0

FALSE * FALSE = 0

This is called AND logic. The image shows that the first date range and the fourth date range overlap the first date range.

#### Step 4 - Sum values in array

SUMPRODUCT((C6<=$D$6:$D$12)*(D6>=$C$6:$C$12))

becomes

SUMPRODUCT({1;0;0;1;0;0;0})

and returns 2.

This means that there are two date ranges overlapping. The one we are comparing with, of course, is overlapping and another one on row 4.

#### Step 5 - Check if sum is larger than 1

SUMPRODUCT((C6<=$D$6:$D$12)*(D6>=$C$6:$C$12))>1

becomes

2>1 returns TRUE in cell F6.

#### Final notes

If you are only comparing one date range with another you can simply use the MEDIAN function.

## 2. Find overlapping date ranges with criterion

Brett asks:

Hey Oscar,

I tried this and I can't get accurate results with the data set I'm working with.

As an example, how would the formula work if I wanted to find the overlap between the start 2/end 2 dates versus start 1/end 1 dates?

Title - Start 1 End 1 Start 2 End 2 Overlap?

Titans 6/1/14 5/31/15 6/1/14 6/30/14

Titans 6/1/16 5/31/17 8/1/14 8/31/14

Titans 6/1/18 5/31/19 6/1/17 5/31/18

Titans 7/1/21 6/30/23 6/1/19 2/29/20

In the above example, in the "overlap" cell, it should say "yes" for row 1 and row 2, and "no" for row 3 and row 4.

Thanks so much for the help!

**Answer:**

This example demonstrates a formula that identifies overlapping date range based on two date ranges and a condition specified in column A. The first date range specified in cells B2:C2 is compared to date ranges in columns D and E.

The second date range specified in cells D2:E2 is compared to date ranges in columns B and C.

Formula in cell F2:

### Explaining formula

#### Step 1 - Check if start date in cell B2 is smaller than or equal to end dates in cells $E$2:$E$5

The smaller than, larger than, and the equal characters are logical operators that allow you to compare Excel dates. Excel dates are regular numbers, 1 is 1/1/1900 and 2 represents 1/2/1900, and so on.

The result is a boolean value TRUE or FALSE based on if the condition is met or not.

returns {TRUE; TRUE; TRUE; TRUE}.

#### Step 2 - Check if end date in cell C2 is larger than or equal to start dates in cells $D$2:$D$5

C2>=$D$2:$D$5

returns {TRUE; TRUE; FALSE; FALSE}

#### Step 3 - Multiply arrays (AND logic)

The asterisk character lets you multiply numbers in an Excel formula, this works also fine with arrays.

In other words, both values must be TRUE to return TRUE. The equivalent to TRUE is 1 and FALSE is 0 (zero), this is the result after multiplying Boolean values.

The parentheses are needed to control the order of operation, we need to perform the comparisons before we multiply the arrays.

(B2<=$E$2:$E$5)* (C2>=$D$2:$D$5)

returns {1; 1; 0; 0}.

#### Step 4 - Check if the start date in cell D2 is smaller than or equal to end dates in cells $C$2:$C$5

D2<=$C$2:$C$5

returns {TRUE; TRUE; TRUE; TRUE}.

#### Step 5 - Check if end date in cell E2 is larger than or equal to start dates in cells $B$2:$B$5

E2>=$B$2:$B$5

returns {TRUE; FALSE; FALSE; FALSE}.

#### Step 6 - Multiply arrays (AND logic)

(D2<=$C$2:$C$5)* (E2>=$B$2:$B$5)

returns {1;0;0;0}.

#### Step 7 - Add arrays (OR logic)

The plus sign lets you add numbers in an Excel formula, it also lets you apply OR logic to boolean values.

The result after adding boolean values is their numerical equivalents, TRUE is 1 and FALSE is 0 (zero).

(B2<=$E$2:$E$5)* (C2>=$D$2:$D$5)+ (D2<=$C$2:$C$5)* (E2>=$B$2:$B$5)

becomes

{1; 1; 0; 0} + {1; 0; 0; 0}

and returns {2; 1; 0; 0}.

#### Step 8 - Check if condition in cell A2 matches cells $A$2:$A$5

A2=$A$2:$A$5

returns {TRUE; TRUE; TRUE; TRUE}.

#### Step 9 - Multiply arrays (AND logic)

(A2=$A$2:$A$5)* ((B2<=$E$2:$E$5)* (C2>=$D$2:$D$5)+ (D2<=$C$2:$C$5)* (E2>=$B$2:$B$5))

returns {2; 1; 0; 0}.

#### Step 10 - Add values

The SUMPRODUCT function calculates the product of corresponding values and then returns the sum of each multiplication.

Function syntax: SUMPRODUCT(array1, [array2], ...)

SUMPRODUCT((A2=$A$2:$A$5)* ((B2<=$E$2:$E$5)* (C2>=$D$2:$D$5)+ (D2<=$C$2:$C$5)* (E2>=$B$2:$B$5)))

returns 3.

#### Step 11 - Check if number is larger than 0 (zero)

SUMPRODUCT((A2=$A$2:$A$5)* ((B2<=$E$2:$E$5)* (C2>=$D$2:$D$5)+ (D2<=$C$2:$C$5)* (E2>=$B$2:$B$5)))>0

3>0

returns TRUE.

### Overlapping category

I found an old post that I think is interesting to write about today. Think of two overlapping ranges, it […]

The MEDIAN function lets you count overlapping dates between two date ranges. If you have more than two date ranges […]

This article demonstrates a formula that points out row numbers of records that overlap the current record based on a […]

### Excel categories

### 26 Responses to “Identify overlapping date ranges”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

Chandoo has posted a much shorter better formula: https://chandoo.org/wp/2010/06/01/date-overlap-formulas/

Oscar, could you explain the COUNT($B$6:$B$12)-1 bit in the formula...

Peter,

Here is a shorter formula: =SUMPRODUCT((C6<=$D$6:$D$12)*(D6>=$C$6:$C$12)*(ROW(C6)<>ROW($C$6:$C$12)))>0. Copy cell and paste it down as far as needed.

The formula returns TRUE if overlapping.

Peter,

=SUMPRODUCT((C6< =$D$6:$D$12)*(D6>=$C$6:$C$12))>1 is shorter.

Copy cell and paste it down as far as needed.

The formula returns TRUE if overlapping.

Thanks Oscar...... appreciate your prompt feedback

Hey Oscar,

I tried this and I can't get accurate results with the data set I'm working with.

As an example, how would the formula work if I wanted to find the overlap between the start 2/end 2 dates versus start 1/end 1 dates?

Title - Start 1 End 1 Start 2 End 2 Overlap?

Titans 6/1/14 5/31/15 6/1/14 6/30/14

Titans 6/1/16 5/31/17 8/1/14 8/31/14

Titans 6/1/18 5/31/19 6/1/17 5/31/18

Titans 7/1/21 6/30/23 6/1/19 2/29/20

In the above example, in the "overlap" cell, it should say "yes" for row 1 and row 2, and "no" for row 3 and row 4.

Thanks so much for the help!

Brett

Brett,

read this:

Find overlapping date ranges with criterion

Hi Oscar,

Oh my, this is so close, but is just shy of solving the problem.

The problem I'm encountering if is there are multiple "titles".

In the example below, the formula has to find a match in the "title" column and then look at all start and end dates for the matched title to see if there is any cross over.

Here's another example:

Name Start 1 End 1 Start 2 End 2 Overlap?

Titans 6/1/14 5/31/15 6/1/14 6/30/14 TRUE

Titans 6/1/16 5/31/17 8/1/14 8/31/14 TRUE

Titans 6/1/18 5/31/19 6/1/17 5/31/18 FALSE

Titans 7/1/21 6/30/23 6/1/19 2/29/20 FALSE

Campers 10/1/15 9/30/16 10/1/14 9/30/15

Campers 10/1/17 9/30/18 9/1/16 9/30/17

Campers 11/1/21 4/30/22 10/1/17 6/30/20

Dark Horse 6/1/16 11/30/16 12/1/14 11/30/15

Dark Horse 12/1/16 11/30/17 12/1/15 5/31/16

Dark Horse 12/1/18 11/30/19 12/1/16 11/30/18

Gang 4/1/17 3/31/18 4/1/15 3/31/16

Gang 4/1/18 3/31/19 4/1/16 4/30/18

Ants 2/1/17 1/31/18 #N/A #N/A

Ants 2/1/19 1/31/20 #N/A #N/A

Again, this is way out of my league and thanks so much for putting your excel expertise to work!

Brett

Brett,

I am not sure I am following, what is the desired outcome in column F?

Hi Oscar,

When I copy (or auto fill) in the formula down in row F, it doesn't calculate the way your example does above and (except for rows 2 and 3), my results are "false" for rows 4 through 13.

Since this is an array formula, is there a special way I have to to copy the formula.

Or, can you post the excel version of your example above so I can look at the formula?

Thanks!

Brett

Brett,

expand the cell references to this:

=SUMPRODUCT((A2=$A$2:$A$13)*((B2<=$E$2:$E$13)*(C2>=$D$2:$D$13)+(D2<=$C$2:$C$13)*(E2>=$B$2:$B$13)))>0

Hi again,

I should also add that my data contains unique "titles" and my goal is for the formula to look at the differing start and end dates for each like title.

Thanks!

Brett

hi brett did u get the answer for your question as i am having similar trouble

Hi Oscar ,

I have similar problem as brett. I also want to check only for that ranges which have similar value for titles. Basically I want to compare overlapping only for those rows which have same value of say column1

Puneet,

Conditional formatting formula:

=SUMPRODUCT(($A2=$A$2:$A$9)*($B2<=$C$2:$C$9)*($C2>=$B$2:$B$9))>1

Good stuff Oscar!

I have a slightly different situation like Puneet's where I have 2 arbitrary reporting dates which I want to apply to a data set like the one you have there. But instead of returning TRUE/FALSE, I need to return the total count of days from the data set which fall between the 2 reporting dates. The output needs to be 1 value, rather than one per row. Struggling to get my head around this!

TC,

Is this what you are looking for?

Hi Oscar, This is really helpful and hoping you can help. My issue is the same as Puneet's in which I do want to identify the overlap based on a criteria but now I want to know what is that min date and the max date. Any tricks up your sleeve?

Thank you!

Liz,

read this post:

Calculate min and max date among overlapping date ranges and based on a condition

Hi Oscar,

Thank you for your post on the min and max. I've been using your formulas but I don't think it is working for the set of values that I'm working with since my dates include time.I have over 12000 records in my list and here is a snippet. Need to calculate the non-overlap hours per Identifier. How can I get to this?

Start End Identifier Non-Overlap Hours per Identifier

11/1/2012 0:00 11/1/2012 10:30 115854 10.5

11/1/2012 0:00 11/1/2012 10:30 117534 10.5

11/1/2012 1:00 11/1/2012 17:00 115854 6.5

11/1/2012 5:00 11/1/2012 15:00 117534 4.5

11/1/2012 10:00 11/1/2012 18:00 118929 8

11/1/2012 10:00 11/1/2012 18:00 118929 0

11/1/2012 14:00 11/1/2012 17:00 113569 3

11/1/2012 14:00 11/1/2012 17:00 113569 0

Using your formula I added an If statement so that if there is an overlap put a 0 and then put a 1 when there is no overlap but I do not think that addresses what I need to solve. Any suggestions are greatly appreciated.

Liz,

I am not following, isn´t the Non-Overlap Hours per Identifier 1 hour, in this example?

11/1/2012 0:00 11/1/2012 10:30 115854 10.5 <-- 1 hour and 11/1/2012 1:00 11/1/2012 17:00 115854 6.5

Hi Oscar,

I see what you mean now that the first one will be 1 hour. I need to calculate the total non-overlap hours per identifier.

I appreciate your help!

[…] Liz asks: […]

Hello,

I am having a problem figuring out the below.

I have multiple identifiers and I need to find out if they have overlapping dates and times? Can someone please help? Thank you kindly.

Facilitator Date Time Overlap

Susannah Cahillane Tuesday, October 7, 2014 04:00 pm-07:00 pm

Emily Ferrara Tuesday, September 30, 2014 04:00 pm-07:00 pm

Lynette Bradley Thursday, October 2, 2014 04:00 pm-07:00 pm

Renata Pienkawa Thursday, December 4, 2014 04:00 pm-06:00 pm

Dana Furbush Thursday, October 2, 2014 03:30 pm-06:30 pm

Ariel Nelson Monday, November 17, 2014 03:30 pm-06:30 pm

Carla Bruzzese Thursday, October 2, 2014 04:00 pm-07:00 pm

Elizabeth Gospodarek Thursday, October 2, 2014 04:00 pm-07:00 pm

Sunita Mehrotra Monday, September 22, 2014 04:00 pm-07:00 pm

Kellie Jones Thursday, October 9, 2014 04:30 pm-07:30 pm

Pavlina Gatikova Tuesday, October 7, 2014 04:00 pm-06:00 pm

Gail Arsenault Monday, October 6, 2014 03:45 pm-06:45 pm

Sunita Mehrotra Wednesday, October 1, 2014 04:30 pm-07:30 pm

Sunita Mehrotra Tuesday, October 7, 2014 04:30 pm-07:30 pm

Christine Nicholson Wednesday, October 1, 2014 04:30 pm-06:30 pm

Allison Levit Monday, October 27, 2014 03:30 pm-06:30 pm

Peter Dillon Wednesday, October 1, 2014 04:00 pm-07:00 pm

Hi Oscar,

Thank you for this wonderful resource you've created here.

I was able to use your formula to identify overlapping dates, however, I have to sum values from a column based upon overlapping dates.

In the example below I have a set of allowances provided by a coffee vendor for one of their products. I would need to have excel add $5.04 to $1.26 because the second row allowance overlaps with the first row's dates and then have this logic applied throughout the table. Multiple allowances can be summed if there are multiple date overlaps. Might you be able to show how I could have excel sum the allowances and maybe even identify the exact dates that are overlapping?

I have referenced your other pages on accounting for overlapping dates over multiple ranges, but I am afraid that setting up a matrix will not prove practical when the dates span over several months and we may be querying thousands of rows at one time.

ITEM_DESCRIP ALLOW_DATE_EFF ALLOW_DATE_EXP ALLOW_AMT ALLOW_TYPE OVERLAPPING?

CAMERONS DECAF BREAKFAST BLEND 10 OZ 2/24/2020 3/23/2020 $5.04 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 3/1/2020 3/16/2020 $1.26 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 3/22/2020 4/20/2020 $1.26 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 3/23/2020 4/20/2020 $5.04 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 4/20/2020 5/18/2020 $5.04 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 5/18/2020 6/15/2020 $5.04 PA TRUE

CAMERONS DECAF BREAKFAST BLEND 10 OZ 6/15/2020 7/13/2020 $5.04 PA TRUE

Hi Oscar,

Thanx for your answers. I have slightly different problem and I cant find solution.

I am trying to calculate how many calls overlap at my call center at one time, so I can better plan shifts. I am using this formula:

=SUMPRODUCT(--((C2+O2=$C$2:$C$11870+$O$2:$O$11870)=0))

However, I would like to know number of overlaped calls, when the overlap is longer than, lets say 10seconds.

Can you help please.

Thanx Milos