• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

How To Calculate The Difference Between Two Dates in Excel

How To Calculate The Difference Between Two Dates in Excel

We require calculating the difference between two dates for many purposes in our daily life. Excel consists of many functions that easily calculate the difference between two dates.

Mostly this difference is required for Payroll purposes for calculating the number of days worked in a month for preparing salaries.

In Accounting, it is required for knowing due dates of payments and in HR for employee benefits.

You can use the DATEDIF function to easily calculate the difference between two dates. With this function, you can calculate the difference in days, weeks,  months and years.

Let us understand it with an example.

Copy below data in your worksheet and copy it in 2 times.

Start Date              End Date

5/4/2015                4/3/2017

Note: Please make sure that the format of the cell is set to date format.

In C1 put the heading Difference. In C2 put an equal sign and insert the DATEDIF Function. The DATEDIF function has  3 arguments in the syntax.

=DATEDIF(Start_Date, End_Date, Unit)

You can either put the dates directly in the formula or use cell reference. Choose the desired unit. “Y” for the year, “M” for the month and “D” for days.

1. Finding the difference in Number of days

Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “D”).

OR

Formula with Cell Reference: =DATEDIF(A2,B2, “D”)

The result will be 700 days. To calculate the difference in weeks, just divide the whole formula with 7. =DATEDIF(A2, B2, “D”)/7

2. Finding the difference in Months

Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “M”).

OR

Formula with Cell Reference: =DATEDIF(A2,B2, “M”).

Here you get the result as 22 months.

Two Dates

3. Finding the difference in Years

Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “Y”).

OR

Formula with Cell Reference: =DATEDIF(A2,B2, “Y”).

You get the result as 1 year. This function counts the number of full years between the dates. This is how you can use the DATEDIF function to calculate the difference between two dates

To learn other functions like MID, QUOTIENT and KURT Functions, please click on the name of the function.

We thank our readers for liking, sharing and following us on different social media platforms.

If you have any queries please share in the comment section below. I will be more than happy to assist you.

Filed Under: Microsoft Excel

You are Here: Home / Reader's Question / Microsoft Excel / How To Calculate The Difference Between Two Dates in Excel

About Shabbir Bhimani

I have worked in Excel and like to share functional excel templates at ExcelDataPro.

Comments

  1. Scott Farris says

    October 8, 2019 at 9:41 pm

    It would be nice to show an example using “today()” in the “datedif” function. Often people need to find difference between today and some starting point.

    Reply
    • Fahim Lashkaria says

      October 9, 2019 at 4:33 pm

      Hey Scott, thanks for the suggestion. Will include it in the article with example.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

ExcelDataPro

Free Excel Pro Templates

  • Glossary
    • Accounting Glossary
    • HR & Payroll Glossary
    • Tax Glossary
  • Templates
    • Accounting
      • Financial Analysis
      • Financial Statement
    • Educational
    • Taxation
      • Federal Income Tax
      • GST
      • UAE VAT
      • UK VAT
    • Human Resources
      • HR & Payroll
      • HR Metrics
    • School Management
    • Social Media
    • Sales-Marketing
    • Personal Finance
    • Other
      • Health & Fitness
  • Functions
  • Calculators
  • Home
  • Contact
  • Privacy
  • Terms

© ExcelDataPro 2025. Content Licensed Under Creative Commons with Attribution Required

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT