Skip to main content

Excel Formula: Calculate overlapping days between two date ranges

doc calculate overtime pay 4

In this tutorial, it provides a formula to calculate the overlapping days between two date ranges in Excel. For example, the first given date range is 1/1/2020-6/20/2020, and the project A is proceeded in the date range 8/16/2019-1/2/2020, there are 2 overlapping days between these two date ranges as above screenshot shown.

If you want to follow along with this tutorial, please download the example spreadsheet.
doc sample

Generic formula:

MAX(MIN(end1,end2)-MAX(start1,start2)+1,0)

Arguments

End1, start1: the end date and start date in the first date range.
End 2, start2: the end date and start date in the second date range.

Return value

The formula returns the overlapping days with a numeric value.

How this formula work

Here the projects are proceeded in different date ranges, we want to calculate the overlapping days between date range of each project and a given fixed date range in Range C2:C3.
doc calculate overlapping days 2

In cell H3, please use below formula:

=MAX(MIN($C$3,G3)-MAX($C$2,F3)+1,0)

Press Enter key then drag autofill handle below to calculate the overlapping days.
doc calculate overlapping days 3

Explanation

MIN function is used to find the minimum value in many values. Here it finds out the earlier date between the two end dates.

MAX function is used to find the maximum value in values.

The inner MAX function finds out the later date between two start dates.

To include both start date and end date, we offset the result by adding 1.

=MAX(MIN($C$3,G3)-MAX($C$2,F3)+1,0)
=MAX(43832-43831+1,0)

The outer MAX function is used to display the negative value instead of zero.


Relative Formulas

Relative Functions


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

ūü§Ė Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions‚Ķ
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.

Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Das ist super und der halbe Weg zu der L√∂sung meines Ziels: Start Date und End Date markieren bei mir einen geplanten Projekteinsatz, die Liste der abzugleichenden Daten sind Abwesenheiten in einer gesonderten Tabelle. Ich m√∂chte neben der geplanten Projekteinsatzzeitspanne die Summe der √ľberlappenden Tage, die sich aus den Abwesenheiten ergeben, also in dem Beispiel hier 133 sehen. Eine Idee wie das geht? Ich habe schon eine Formel, die mir alle Start- und Endzeiten der √úberlappenden Abwesenheiten anzeigt, dabei habe ich die Filterfunktion benutzt, aber bei den konkreten Summen komme ich bisher nicht an...

Keine Ahnung ob das jetzt mit dem Foto klappt, ich probiere mal 2 Varianten.

[img]d:\Projekt.jpg[/img]
[img]file:///D:/Projekt.jpg[/img]
This comment was minimized by the moderator on the site
Er det muligt at lave samme formel blot under forudsætning at et år er på 360 dage (fx ved hjælp af funktionen "DAGE360")?
Mvh.Klaus
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations