In practice, we often need to calculate the difference of years, months, weeks or days between 2 separate dates. And like many other calculations, Excel functions can help you calculate the time difference quickly and accurately. Let’s see how to do it.
Case 1: Calculate the Difference of Years
Formula: =DATEDIF(A2,B2,”y”)
A2, B2 corresponds to the cells with the 2 different dates.
“y” refers to years.
Case 2: Calculate the Difference of Months
Formula: =DATEDIF(A2,B2,”m”)
A2, B2 corresponds to the cells with the 2 different dates.
“m” refers to months.
Case 3: Calculate the Difference of Days
Formula: =DATEDIF(A2,B2,”d”)
A2, B2 corresponds to the cells with the 2 different dates.
“d” refers to days.
Enter the formula in C2 and use fill handle to apply it to multiple cells.
Case 4: Calculate the Difference of Weeks
Formula: =DATEDIF(A2,B2,”d”)/7
A2, B2 corresponds to the cells with the 2 different dates.
“d” refers to days.
The difference of weeks is basically dividing the difference of days by 7.
Case 5: Calculate the difference of years, months and days separately
If you want to separately calculate the difference of numbers in years, months and days, you can use these formulas:
Years: =DATEDIF(A2,B2,”y”)
Months: =DATEDIF(A2,B2,”ym”)
Days: =DATEDIF(A2,B2,”md”)
Enter these formulas in 3 cells and press [Enter], you can get the result of the difference of years, months and days separately.
Leave a Reply