How to Calculate the Difference Between Two Dates in Excel (2024)

In this article, we will guide you on how to calculate the difference between two dates in Excel using the DATEDIF function. This function allows you to find the difference in days, weeks, months, or years between two dates. Let's dive into the details.

Difference in Days

To calculate the difference in days between two dates, follow these steps:

  1. Enter the start date in one cell and the end date in another cell.
  2. In a third cell, type the formula =DATEDIF(start_date, end_date, "d"), where start_date is the reference to the cell containing the start date and end_date is the reference to the cell containing the end date.
  3. Press Enter to get the result.

For example, if the start date is in cell D9 and the end date is in cell E9, the formula would be =DATEDIF(D9, E9, "d").

Difference in Weeks

To calculate the difference in weeks between two dates, follow these steps:

  1. Enter the start date in one cell and the end date in another cell.
  2. In a third cell, type the formula =DATEDIF(start_date, end_date, "d")/7, where start_date is the reference to the cell containing the start date and end_date is the reference to the cell containing the end date.
  3. Press Enter to get the result.

For example, if the start date is in cell D13 and the end date is in cell E13, the formula would be =DATEDIF(D13, E13, "d")/7.

Difference in Months

To calculate the difference in months between two dates, follow these steps:

  1. Enter the start date in one cell and the end date in another cell.
  2. In a third cell, type the formula =DATEDIF(start_date, end_date, "m"), where start_date is the reference to the cell containing the start date and end_date is the reference to the cell containing the end date.
  3. Press Enter to get the result.

For example, if the start date is in cell D5 and the end date is in cell E5, the formula would be =DATEDIF(D5, E5, "m").

Difference in Years

To calculate the difference in years between two dates, follow these steps:

  1. Enter the start date in one cell and the end date in another cell.
  2. In a third cell, type the formula =DATEDIF(start_date, end_date, "y"), where start_date is the reference to the cell containing the start date and end_date is the reference to the cell containing the end date.
  3. Press Enter to get the result.

For example, if the start date is in cell D2 and the end date is in cell E2, the formula would be =DATEDIF(D2, E2, "y").

Calculate Age in Accumulated Years, Months, and Days

To calculate someone's age in accumulated years, months, and days, follow these steps:

  1. Enter the birth date in one cell and the current date in another cell.
  2. In a third cell, type the formula =DATEDIF(birth_date, current_date, "y"), where birth_date is the reference to the cell containing the birth date and current_date is the reference to the cell containing the current date.
  3. In a fourth cell, type the formula =DATEDIF(birth_date, current_date, "ym"), where birth_date and current_date are the same as in the previous formula.
  4. In a fifth cell, type the formula =current_date-DATETIME(DATE(YEAR(current_date),MONTH(current_date),1)), where current_date is the reference to the cell containing the current date.
  5. Press Enter to get the results.

For example, if the birth date is in cell D17 and the current date is in cell E17, the formulas would be:

  • For total years: =DATEDIF(D17, E17, "y")
  • For remaining months: =DATEDIF(D17, E17, "ym")
  • For remaining days: =E17-DATETIME(DATE(YEAR(E17),MONTH(E17),1)).
Optional: Combine Three Formulas in One

If you want to combine all three calculations (years, months, and days) in one cell, follow these steps:

  1. Enter the birth date in one cell and the current date in another cell.
  2. In a third cell, type the formula =DATEDIF(birth_date, current_date, "y") & " years, " & DATEDIF(birth_date, current_date, "ym") & " months, " & current_date-DATETIME(DATE(YEAR(current_date),MONTH(current_date),1)) & " days", where birth_date and current_date are the same as in the previous formulas.
  3. Press Enter to get the result.

For example, if the birth date is in cell D17 and the current date is in cell E17, the formula would be =DATEDIF(D17, E17, "y") & " years, " & DATEDIF(D17, E17, "ym") & " months, " & E17-DATETIME(DATE(YEAR(E17),MONTH(E17),1)) & " days".

Conclusion

In this article, we have discussed how to calculate the difference between two dates in Excel using the DATEDIF function. We covered the calculations for days, weeks, months, and years, as well as calculating age in accumulated years, months, and days. By following these steps, you can easily calculate date differences and age in Excel.

Remember, Excel provides various functions to perform date and time calculations, and the DATEDIF function is a powerful tool for calculating date differences.

How to Calculate the Difference Between Two Dates in Excel (2024)

References

Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 5371

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.