Introduction
DATEDIF function in Excel is a type of DATE/TIME function. This function helps us in finding difference between two dates in form of month or year or day. It is bifurcated as (DATE+DIFEERENCE). We get in return a number representing time interval between the dates.
Syntax
=DATEDIF(START-DATE, END-DATE,UNIT)
Arguments
- START-DATE:- This is the start date and should be written in default Excel date serial number formatting.
- END-DATE:- This is the end date and should be written in default Excel date serial number formatting
- UNIT:- This is the time unit we are using in form of day or month or year.
Unit values
UNIT | VALUE |
D | Difference in term of days |
M | Difference in term of months |
Y | Difference in terms of years |
MD | Difference in terms of days while ignoring months and years |
YD | Difference in terms of days while ignoring only years |
YM | Difference in terms of months ignoring days and years |
Keynotes
- This function was only calibrated for Excel 2000 but it can be used for other variants which came after this version but in later versions you have to fill arguments manually as Excel will not help in filling arguments. But if entered in correct configuration, it will work as desired.
- If the difference between start and end date is negative or end date is bigger than start date than this function shows a #num error.
- Unit argument specifies the time unit in which you will get results.
EXAMPLES
In the first example we have shown how to use all the units shown above in DATEDIF function.Differences in two dates in terms of years, months, days are shown.
In this example we foundage of a person using DATEDIF function in terms of years, months, days. Wedifferentiated between Date of Birth and Current Date.