Tuesday, 6 October 2015

DATEDIF function to Calculate Difference of two Dates


Dear all,
Today we are going to share one excel Worksheet function named DATEDIF function, which is returns the difference between two date values. Using this formula we are going to find Age in Year, month and Day.

SYNTAX

 DATEDIF( start_date, end_date, interval )

Parameters

start_date and end_date : start_date and end_date is the two dates to calculate the difference between.

Interval

Interval
Explanation
Y
The number of complete years.
M
The number of complete months.
D
The number of complete days.
MD
The difference between the days (months and years are ignored).
YM
The difference between the months (days and years are ignored).
YD
The difference between the days (years and dates are ignored).

For Example:

Using this formula we are going to find Age in Year, month and Day.



Calculation for B3 that’s mean for Year

Simply formula is
                = DATEDIF(A3,TODAY(),"Y")
                =26
If we want to result like ‘26 Year’ then,
                = DATEDIF(A3,TODAY(),"Y")&"  Year"
                =26 Year
If we want to Result is ‘No DOB’, if A3 Cell is Blank then,
                =IF(A3=0,"No DOB",DATEDIF(A3,TODAY(),"Y")&"  Year")
                =26 Year

Calculation for C3 that’s mean for Month

Simply formula is
                = DATEDIF(A3,TODAY(),"YM")
                =4
If we want to result like ‘26 Year’ then,
                = DATEDIF(A3,TODAY(),"YM")&"  Month"
                =4 Month
If we want to Result is ‘No DOB’, if A3 Cell is Blank then,
                =IF(A3=0,"No DOB", DATEDIF(A3,TODAY(),"YM")&"  Month")
                =4 Month

Calculation for D3 that’s mean for Day

Simply formula is
                =DATEDIF(A3,TODAY(),"MD")
                =25
If we want to result like ‘26 Year’ then,
                =DATEDIF(A3,TODAY(),"MD")&"  Day"
                =25 Day
If we want to Result is ‘No DOB’, if A3 Cell is Blank then,
                =IF(A3=0,"No DOB",DATEDIF(A3,TODAY(),"MD")&"  Day")
                =25 Day

Idea is taken by Tech on The Net


Search on This Blog