Top Header ADS

DATEDIF Function in Excel

What is the DATEDIF function in Excel?

→ The MS Excel DATEDIF function returns the difference between two date values in years, months, or days.

→ It is a built-in function in Excel, and we can put it in the DATE/Time Function Category.

→ It is a worksheet function. So we can enter this function directly into cells.

→ With the help of this function, we can get days, months, or years between two dates.


What is the syntax of the DATEDIF function?

→ The syntax for the DATEDIF function in Microsoft Excel is:

=DATEDIF (start_date, end_date, unit)

The Syntax Parameter or Syntax Arguments of DATEDIF function are:

➨ start_date - Start date in Excel date serial number format.

➨ end_date - End date in Excel date serial number format.

➨ unit - The time unit to use (years, months, or days).


➨ Time units

→ The DATEDIF function can calculate the time between a start_date and an end_date in years, months, or days.

→ The time unit is specified with the unit argument, which is supplied as text.

→ The table below summarizes available unit values and the result for each.

→ Time units can be given in upper or lower case (i.e. "ym" is equivalent to "YM").

Unit Table

➨ The different time units are:

→ "Y" - Difference in complete years

→ "M" - Difference in complete months

→ "D" - Difference in days

→ "MD" - Difference in days, ignoring months and years

→ "YM" - Difference in months, ignoring years

→ "YF" - Difference in days, ignoring years


Examples of DATEDIF Function:

→ For a detailed understanding, we will take some examples as mentioned below.

→ As we know the syntax of the DATEDIF Function =DATEDIF (start_date, end_date, unit), So we will take example accordingly.

Example of DATEDIF Function in Excel

Ex. – 01: Using Unit “Y” – Y stands for Year

→ As per the syntax, the formula will be =DATEDIF(A2,B2,C2) and from the photo, we can see the result = 5

→ So, we got the result between the starting date and the ending date is 5 years.


Ex. – 02: Using Unit “M” – M stands for Month

→ As per the syntax, the formula will be =DATEDIF(A3,B3,C3) and from the photo, we can see the result = 63

→ So, we got the result between the starting date and the ending date is 63 months.

 

Ex. – 03: Using Unit “D” – D stands for Day

→ As per the syntax, the formula will be =DATEDIF(A4,B4,C4) and from the photo, we can see the result = 1917

→ So, we got the result between the starting date and the ending date is 1917 days.


Ex. – 04: Using Unit “MD” –  This shows the difference in days ignoring months and years. 

→ As per the syntax, the formula will be =DATEDIF(A5,B5,C5) and from the photo, we can see the result = 0

→ So, we got the result between the starting date and ending date is 0 days because the unit “MD” is calculated only day difference ignoring the years and months.


Ex. – 05: Using Unit “YM” –  This shows the difference in months ignoring days and years. 

→ As per the syntax, the formula will be =DATEDIF(A6,B6,C6) and from the photo, we can see the result = 3

→ So, we got the result between the starting date and ending date is 3 months because the unit “YM” is calculated only month difference ignoring the years and days.


Ex. – 06: Using Unit “YD” –  This shows the difference in days ignoring years. 

→ As per the syntax, the formula will be =DATEDIF(A7,B7,C7) and from the photo, we can see the result = 90

→ So, we got the result between the starting date and ending date is 90 days because unit “YD” is calculated only day difference ignoring the years.


👉 For a regular update:

➨ Join us (Telegram Channel)

➨ Join us (LinkedIn Page)


👉 Also Navigate Our Popular Category:

➨ Statistical Functions

➨ Date & Time Functions

➨ Logical Functions

➨ Lookup & Reference Functions

➨ Math Functions

➨ MS Excel Sitemap

➨ 7 QC Tools Excel Templates

➨ Lean Six Sigma Excel Templates

➨ MS Excel Templates

Post a Comment

Previous Post Next Post