EXCEL DATEDIF FUNCTION

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 :

  • Start date – This is a mandatory input. It is, as the name implies, the first day of the period.
  • End date – Another needed input. It reflects the period’s last, or finishing, date.
  • Unit – The time unit in which we desire the information is referred to as the unit.

 

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.

Step By Step Guide of DATEDIF Function

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

datedif function
  • #NUM! error – This occurs when the start date exceeds the end date.
  • #VALUE! Error – Occurs when Excel is unable to detect the date entered, i.e. when the date argument is incorrect.

Related Functions

HLOOKUP Function

HLOOKUP Function

Explore Now

VLOOKUP Function

VLOOKUP Function

Explore Now

INDEX Function

INDEX Function

Explore Now

MATCH Function

MATCH Function

Explore Now

DATE Function

DATE Function

Explore Now

IF Function

IF Function

Explore Now

OR Function

OR Function

Explore Now

AND Function

AND Function

Explore Now

RANK Function

RANK Function

Explore Now

SUMIF Function

SUMIF Function

Explore Now

XIRR Function

XIRR Function

Explore Now

WORKDAYS Function

WORKDAYS Function

Explore Now