In the previous post, we saw ‘How to Create a Drop-Down List in the Microsoft Excel?’, now we will learn about how to Calculate the Difference between Two Dates?.
Which Function to use?
When you want to calculate the difference between the two dates you can use the ‘DATEDIF’ function. First, put the start date in a cell and then the end date in another cell after that use the DATEDIF function to calculate the difference.
Syntax
DATEDIF(start_date,end_date,unit)
Arguments
start_date [Required]:
A date that represents the first, or starting date of a given period. Dates may be entered as text strings within quotation marks (for example, “2001/1/30”), as serial numbers (for example, 36921, which represents January 30, 2001, if you’re using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE(“2001/1/30”)).
Note: If the Start_date is greater than the End_date, the result will be #NUM!.
end_date [Required]:
A date that represents the last, or ending, date of the period.
Unit:
The type of information that you want returned, where:
Unit | Returns/Output |
---|---|
“D“ | The number of days in the period. The difference in days. |
“M“ | The difference in months. The number of complete months in the period. |
“Y“ | The difference in years. The number of complete years in the period. |
“YM“ | The difference between the months in start_date and end_date. The days and years of the dates are ignored |
“YD“ | The difference between the days of start_date and end_date. The years of the dates are ignored. |
“MD“ | The difference between the days in start_date and end_date. The months and years of the dates are ignored. |
Understand With Example
Difference in Days
The “d” returns the number of full days between the two dates.

Difference in Weeks
In this example, the start date is in cell C7, C8, and the end date is in D7, D8. The result in F7, F8. The “d” returns the number of full days between the two dates. Divide it by /7 at the end. That divides the number of days by 7 since there are 7 days in a week. Note that this result also needs to be formatted as a number. Press CTRL + 1. Then click Number > Decimal places: 2.

Difference in Months
In this example, the start date is in cell C7, C8, & C9 and the end date is in D7, D8 & D9. The result is in cell F7, F8 & F9. the “m” returns the number of full months between the two days.

Difference in Years
In this example, the start date is in cell C7, C8, & C9 and the end date is in D7, D8 & D9. The result is in cell F7, F8 & F9. The “y” returns the number of full years between the two days.

Learn TallyPrime
For Latest Updates & Learning Join Our YouTube Channel: Join Now