The DATEDIF Function in Excel is classified as a Date/Time function. As a financial analyst, we may need to know the number of days, months, or years that have passed between two dates. The DATEDIF function assists us in computing the difference.
Syntax :
=DATEDIF(start_date,end_date,unit)
Parameters :
Unit | Returns |
“Y” | Difference in total years. The function returns the total number of years in the era. |
“M” | Month-to-Month Variation. The function returns the total number of months in the period. |
“D” | Difference in Total Days. The function returns the total number of days in the period. |
“MD” | It computes the difference in days between start date and end date. The dates’ months and years are omitted here. |
“YM” | It computes the month difference between start date and end date. The dates’ days and years are disregarded here. |
Example :
The DATEDIF function using the “M” unit can be used to count the number of complete months between dates and To calculate the difference in days, we may use the DATEDIF function using the “D” unit.
=DATEDIF(start date, end date, “m”) compares the dates in b4 (start date) and C4 (end date) and returns the month difference: 8
=DATEDIF(start date, end date, “d”) compares the dates in b6 (start date) and C6 (end date) and returns the month difference: 16
Ask Your Query