+ Reply to Thread
Results 1 to 10 of 10

Calculate Date 5 years in the future past today's date

Hybrid View

  1. #1
    Registered User
    Join Date
    05-29-2015
    Location
    Denver, Colorado
    MS-Off Ver
    2013
    Posts
    8

    Calculate Date 5 years in the future past today's date

    Hi, I was just told about this forum. Looks helpful, found a few tips that helped me, except for one answer to my needs. We have an HR application that we need to put in Excel. We have an Hire date and a Modification date. Basically, when someone is hired, the first 5 years they get X amount of hours of vacation. Then years 6-10, they get an extra X amount of hours of vacation, so on, to 16+ years where they max out. I am trying to do a calculation on a date, that needs to be the first day of the following month, unless the date is already the first of the month, and 5 years in the future. Kind of hard to explain, but let me give you examples:

    0-5 years they get 192 hours
    6-10 years they get 240 hours
    11-15 years they get 288 hours
    16+ years, they get 336 hours.

    The hours are not important for this question, but for the hire date, let's say:

    Hired ----------- Next Mod
    03/15/2015 ---- 04/01/2020 (it needs to round out to the first of the following month + 5 years)
    02/01/2012 ---- 02/01/2017 (Hire date was already on the first of the month, so we don't go to the following month)
    07/15/2009 ---- 08/01/2019 (note, this is their second mod date, they are currently in years 6-10, on 8/1/2019 they will change to 11-15 years)
    09/05/1995 ---- maxed or 0 (They already have worked 16+ years, so they are maxed out, no future mod date - enter the words "maxed" or a simple zero will do)

    I have sort of figured out 5 years in the future by using this formula, =DATE(YEAR(Q2)+5,MONTH(Q2),DAY(Q2)) but not sure how to round to the next month if the day of the month is greater than 1 and have +10 or +15 years if the hire date was further back.

    Thanks!

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Calculate Date 5 years in the future past today's date

    Looking at your sample dates this should do it
    Formula: copy to clipboard
    =EOMONTH(EDATE(A2,MIN(3,FLOOR(YEARFRAC(A2,TODAY())/5,1)+1)*5*12),--(DAY(A2)>1)-1)+1

    A2 is the startdate. Assumed that the current date is the benchmark.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    05-29-2015
    Location
    Denver, Colorado
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculate Date 5 years in the future past today's date

    Quote Originally Posted by Tsjallie View Post
    Looking at your sample dates this should do it
    Formula: copy to clipboard
    =EOMONTH(EDATE(A2,MIN(3,FLOOR(YEARFRAC(A2,TODAY())/5,1)+1)*5*12),--(DAY(A2)>1)-1)+1

    A2 is the startdate. Assumed that the current date is the benchmark.
    That's very impressive! That got what I need, I just need to figure out when they are already maxed out. Thank you!

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Calculate Date 5 years in the future past today's date

    I just need to figure out when they are already maxed out. Thank you!
    When the resulting date < today then they're maxed out, isn't it?

  5. #5
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Calculate Date 5 years in the future past today's date

    When the resulting date < today then they're maxed out, isn't it?
    Well, actually that's not quite true.
    I think you can figure it out like this (part of the formula the calculate the modification date)>
    Formula: copy to clipboard
    =FLOOR(YEARFRAC(A2,TODAY())/5,1)+1>3

    When TRUE they're maxed out, I think (again).

  6. #6
    Registered User
    Join Date
    05-29-2015
    Location
    Denver, Colorado
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculate Date 5 years in the future past today's date

    Yes correct, but I need the field to show a zero or the words "maxed" in the cell when they are maxed out.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,730

    Re: Calculate Date 5 years in the future past today's date

    Isn't maxed out after the 16 year date? Try this version to show the required date or "maxed"

    =IF(TODAY()>EOMONTH(Q2-1,192)+1,"maxed",LOOKUP(TODAY(),EOMONTH(Q2-1,{-1,1,2;1,2,3}*60)+1))

    Edit: although I'm not sure what you want to do if the date is between 15 and 16 years past - what result should you get if Q2 = 01/01/2000?
    Last edited by daddylonglegs; 05-29-2015 at 05:10 PM.
    Audere est facere

  8. #8
    Registered User
    Join Date
    05-29-2015
    Location
    Denver, Colorado
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculate Date 5 years in the future past today's date

    Quote Originally Posted by daddylonglegs View Post
    Isn't maxed out after the 16 year date? Try this version to show the required date or "maxed"

    =IF(TODAY()>EOMONTH(Q2-1,192)+1,"maxed",LOOKUP(TODAY(),EOMONTH(Q2-1,{-1,1,2;1,2,3}*60)+1))

    Edit: although I'm not sure what you want to do if the date is between 15 and 16 years past - what result should you get if Q2 = 01/01/2000?
    Your formula works just like I expected. Thank you! If Q2 = 01/01/2000 then the result would be "maxed". They are 15 years and almost 6 months into it since their hire date, so they max out. Anything greater than 15 years (15 years and 1 day) is maxed. 14 years, 11 months and 29 days, they are still at 10-15 years vacation pay rate.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,730

    Re: Calculate Date 5 years in the future past today's date

    OK, but you need a small amendment, then

    =IF(TODAY()>EOMONTH(Q2-1,180)+1,"maxed",LOOKUP(TODAY(),EOMONTH(Q2-1,{-1,1,2;1,2,3}*60)+1))

  10. #10
    Registered User
    Join Date
    05-29-2015
    Location
    Denver, Colorado
    MS-Off Ver
    2013
    Posts
    8

    Re: Calculate Date 5 years in the future past today's date

    Quote Originally Posted by daddylonglegs View Post
    OK, but you need a small amendment, then

    =IF(TODAY()>EOMONTH(Q2-1,180)+1,"maxed",LOOKUP(TODAY(),EOMONTH(Q2-1,{-1,1,2;1,2,3}*60)+1))
    I checked a few cells and calculated the dates, looks like this solved it for me. Appreciate it, guys!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. calculate no. of years between a date and today's date
    By Aladin Akyurek in forum Excel Formulas & Functions
    Replies: 36
    Last Post: 09-06-2005, 07:05 AM
  2. [SOLVED] calculate no. of years between a date and today's date
    By Sue in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  3. calculate no. of years between a date and today's date
    By Sue in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  4. calculate no. of years between a date and today's date
    By Sue in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  5. How do I Calculate a future or past date in Excel?
    By MosMash in forum Excel General
    Replies: 2
    Last Post: 07-06-2005, 06:05 PM

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