![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: Robert Soper
Posts: 23
|
Name Hire Date TODAY YEARS
Arnett 09/12/1996 05/21/2002 I have a spreadsheet contianing employees. I would like to be able to automatically calculate years of employement based on "hire date" (Fixed) and "today" (Variable - using today function, in expression builder). I would like the answer to be formated in one of the following YEARS or MONTHS or DAYS or a combination of the three. Thanks for your help. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
=DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")& " months "&DATEDIF(A2,TODAY(),"YD")&" days"
where cell A2 contains your hire date. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 175
|
if you do TODAY-HIREDATE it will give you length of service in days.
__________________
Regards, Mike. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Location: Robert Soper
Posts: 23
|
It appears that the day calculation has something wrong
Example1 Date hire: 4/18/2001 Today: 5/21/2002 Given Answer: 1 year 1 month 33 days Correct Answer: 1 year 2 months 3 days Example2 Date hire: 9/12/1996 Today:5/21/2002 Given Answer: 5 years 8 months 251 days Correct Answer: 4 years 9 months 6 days Thanks again |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
You're right!! I made a typo on the 3rd argument of the last DATEDIF. Instead, use...
=DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")& " months "&DATEDIF(A2,TODAY(),"MD")&" days" If you have XL2000 you might want to have a look at the Help topic for "DATEDIF worksheet function" for an explanation of the 3rd argument. [ This Message was edited by: Mark W. on 2002-05-21 07:49 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|