How to Calculate Difference of Dates in Excel

August 3, 2023 1.8K views

Have you ever struggled with dates in Excel? You're not alone. We often forget about a handy tool that can calculate the difference between dates. Don't worry if it sounds tricky – this article is here to help! We will show you simple steps to do it quickly and correctly in Excel. We'll also mention a free tool called WPS Office that makes the job even easier. Let's make Excel work for us, not the other way around!

How to Calculate the Difference of Dates in Excel?

How to Use?

Calculating the difference between two dates in Excel is made possible by the DATEDIF function. This function requires three arguments: the start date, the end date, and a unit of time (represented as "d" for days, "m" for months, "y" for years).

Each unit unlocks Excel's ability to display the date difference in your desired format.

Follow along with our tutorial, and you can swiftly determine date differences in various formats.

Difference in Days

If you wish to calculate the difference in days, use the "d" parameter.

Example: =DATEDIF(D9,E9,"d")

This formula calculates the number of full days between the dates in cells D9 and E9.

Difference in Weeks

To find the difference in weeks, divide the number of days by 7.

Example: =(DATEDIF(D13,E13,"d")/7)

Don't forget to format the result as a number with two decimal places.

Difference in Months

If months are your preferred unit, use the "m" parameter.

Example: =DATEDIF(D5,E5,"m")

This formula gives you the number of full months between the two dates.

Difference in Years

To measure the date difference in years, utilize the "y" parameter.

Example: =DATEDIF(D2,E2,"y")

This formula will return the number of full years between the two dates.

Advanced Calculations - Years, Months, and Days

For a more detailed age or duration calculation, Excel can even break down the difference into a format of "2 years, four months, five days."

You'll need to use the DATEDIF function with different parameters ("y," "ym," "MD") and then combine them in one cell.

The "y" parameter provides the number of full years, "ym" the remaining months past the last full year, and "md" the remaining days.

However, using the "MD" argument in DATEDIF might give inaccurate results, and alternative methods should be considered.

Best Alternative to Microsoft Office - WPS Office

For many, Microsoft Office has been the go-to solution for office productivity tools. However, alternatives have emerged in recent years that challenge Microsoft Office's dominance. One such robust contender is WPS Office.



WPS Office- Free All-in-One Office Suite
  • Use Word, Excel, and PPT for FREE, No Ads.

  • Edit PDF files with the powerful PDF toolkit.

  • Microsoft-like interface. Easy to learn. 100% Compatibility.

  • Boost your productivity with WPS's abundant free Word, Excel, PPT, and CV templates.

5,820,008 User


Algirdas Jasaitis

What is WPS Office?

WPS Office, founded in 1988, is a high-performing and versatile office suite. It provides an array of services that mirror those of Microsoft Office.

Consisting of Writer (a word processor), Presentation (for creating slideshows), and Spreadsheets, WPS Office offers advanced features that cater to the modern office's needs, making it a worthy alternative to Microsoft Office.

  • Budget-Friendly Alternative

The significant advantage of WPS Office lies in its capacity to provide top-quality services that are at par with Microsoft Office but at a fraction of the price.

Its appealing and user-friendly interface eases the transition for those used to Microsoft Office, minimizing the learning curve usually associated with adopting new software.

  • No Compatibility Issue

WPS Office is the best with its seamless compatibility with Microsoft Office. Users can open, edit, and save documents in the same formats used by Microsoft Word, Excel, and PowerPoint. Those using Microsoft Office will not lose formatting or content when exchanging files.

  • Solving Problems with WPS Office's Proactive Customer Support

WPS Office is committed to providing a comprehensive customer support system. It includes online tutorials, a dedicated FAQ section, and a responsive customer service team.

Detailed guides are available to help users navigate the software, enabling them to resolve issues quickly and enhance their productivity.

How to Calculate Date Differences In WPS Office?

When managing data in WPS Office, the DATEDIF function is incredibly valuable. It calculates the days between two dates, whether they are days, months, or years apart. This step-by-step tutorial provides a clear process for new users to employ this function.

Step 1: Open your table that records the entry date of the company's employees.

Step 2: Click on cell C2 or the cell where you want the result to appear.

Step 3: Select 'Insert Function' in the options.

Step 4: In the 'Search for Function' dialog box, type DATEDIF.

Step 5: Hit the 'OK' button. The 'Function Arguments' dialog box will appear.

Step 6: In the 'Function Arguments' dialog box, you'll see a field called 'Start Date. Click on cell B2 to set the first employment date from column B as the Start Date.

Step 7: Click on cell E7, which corresponds to the deadline of 9/1/2021, and Press F4 to create an absolute reference, which locks the End Date calculation location.

Step 8: Next is the 'Comparison Unit' field in the dialog box. Depending on what you need, you can enter 'Y' for years, 'M' for months, or 'D' for days. Enter 'Y' (enclosed in double quotes) to calculate the years for this example. Hit the 'OK' button to execute the calculation.

Step 9: Move your cursor to the lower right corner of cell C2. When the cursor changes to a black cross, drag it down to apply the formula to the other cells in column C.


1. Why Isn't My Datedif Working?

Your DATEDIF might not work because the 'end_date' specified is earlier than the 'start_date.' The 'start_date' must always be earlier or equal to the 'end_date' for DATEDIF to function properly.

2. What Are The Common Mistakes When Using Datedif?

One common mistake when using DATEDIF is entering the 'end_date' that precedes the 'start_date.' Another error is the incorrect usage of the 'unit' parameter, which must be enclosed in double-quotes.

3. Does Datedif Handle Leap Years Correctly?

Yes, the DATEDIF function considers leap years when calculating the date difference. It ensures accurate results when the date range includes February 29.

4. Can Datedif Be Used To Calculate Age In Wps Office?

Yes, DATEDIF can be used to calculate age in the WPS Office. By setting the birth date as the 'start_date' and the current date as the 'end_date,' you can calculate the exact age in years, months, or days.


Managing data and analyzing date differences require a high understanding and calculation skills. Excel, with its DATEDIF function, has made it more convenient. The process becomes even more accessible with the alternative software WPS Office, catering to both novices and seasoned Excel users.

In light of these findings, we highly recommend WPS Office for those who need to frequently calculate date differences. Its user-friendly interface, high compatibility with Microsoft Office, and excellent customer support make it an ideal option. So try WPS Office and take your date difference calculations to the next level.

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.