+ Reply to Thread
Results 1 to 3 of 3

display number of years based on a date

  1. #1
    Registered User
    Join Date
    06-12-2005
    Posts
    31

    display number of years based on a date

    Hi all, you've all been a lot of help so far with my project.

    Right now, in a column I would like to display an number (length of employment) based on the hire date.

    In one cell the employee's hire date is entered. In a column of other cells the pay period ending date is displayed and in another column the length of employment is displayed.

    Example:

    03/17/2000


    03/01/2009 8
    03/15/2009 8
    03/29/2009 9
    04/12/2009 9
    04/26/2009 9

    How would I create a formula in the length of employment cells that would indicate the correct number of years based on the hire date and adjusts when the pay period date passes this hire date?
    Last edited by hoser; 03-28-2009 at 01:51 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: display number of years based on a date

    The DATEDIF function would tell you the number or years:

    =DATEDIF($A$1, A4, "y")


    But it wouldn't take the date into consideration. If you use it to count months instead it may be more accurate.

    =DATEDIF($A$1, A4, "m")/12

    But since that gives fractions, too, you wrap that in an INT() function and you're good to go.

    =INT(DATEDIF($A$1, A4, "m")/12)

    Format that cell as General. This appears to work for all your sample data.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-12-2005
    Posts
    31

    Re: display number of years based on a date

    Thank you so much. That worked like a charm!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1