-
2
- #1
Another way to calculate dates in Excel, is a function that has absolutely no documentation in the Excel Help File (except Excel 2000). This function is the DATEDIF() function. It originates from Lotus 1-2-3.
The DATEDIF() function uses the following syntax:
=DATEDIF(start_date,end_date,"unit_code"
The start date has to be less than the end date, or else the function will return an error.
The following are the Unit Codes for the DATEDIF() function:
1. "y" - The years in a period
2. "m" - The months in a period
3. "d" - The days in a period
4. "md" - The difference between the days in a period, w/o the months and years
5. "ym" - The difference between the months in a period, w/o the days and years
6. "yd" - The difference between the days in a period, w/o the years
To calculate the number of years between two dates
=DATEDIF(A1,TODAY(),"y"
& " Years"
To calculate the number of years and months between two dates
=DATEDIF(A1,TODAY(),"y"
& " Years, " & DATEDIF(A1,TODAY(),"ym"
& " Months"
To calculate the number of years, months and days between two dates
=DATEDIF(A1,TODAY(),"y"
& " Years, " & DATEDIF(A1,TODAY(),"ym"
& " Months, " & DATEDIF(A1,TODAY(),"md"
& " Days"
I posted this inside a FAQ I wrote that deals with some of the Date Functions in Excel. If you're interested, then check it out:
faq68-4037
Peace!![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
Mike
Never say Never!!!
Nothing is impossible!!!
The DATEDIF() function uses the following syntax:
=DATEDIF(start_date,end_date,"unit_code"
The start date has to be less than the end date, or else the function will return an error.
The following are the Unit Codes for the DATEDIF() function:
1. "y" - The years in a period
2. "m" - The months in a period
3. "d" - The days in a period
4. "md" - The difference between the days in a period, w/o the months and years
5. "ym" - The difference between the months in a period, w/o the days and years
6. "yd" - The difference between the days in a period, w/o the years
To calculate the number of years between two dates
=DATEDIF(A1,TODAY(),"y"
To calculate the number of years and months between two dates
=DATEDIF(A1,TODAY(),"y"
To calculate the number of years, months and days between two dates
=DATEDIF(A1,TODAY(),"y"
I posted this inside a FAQ I wrote that deals with some of the Date Functions in Excel. If you're interested, then check it out:
faq68-4037
Peace!
![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
Mike
Never say Never!!!
Nothing is impossible!!!