+ Reply to Thread
Results 1 to 10 of 10

Adaptive formula for time shift

Hybrid View

  1. #1
    Registered User
    Join Date
    05-05-2023
    Location
    Rome
    MS-Off Ver
    Office ProPlus 2019
    Posts
    6

    Adaptive formula for time shift

    Dear Excel experts,

    I'm trying to organize an HR cost sheet with several variables for a large number of employees.

    I need to associate a date (date of a salary increase) with the employee's hiring date; the increase 'unlocks' automatically after two years of work.

    The problem is that - based on the hiring date - the increase may not happen exactly two years later, particularly:
    - if the worker is hired on the 1st day of the month, the increase is settled exactly two years later (01/01/23 --> 01/01/25)
    - if the worker is hired after xx/01/23, the increase is settled on the 1st day of the incoming month (xx/02/23 --> xx+1/01/2025)

    Given the number of strings, I would be awesome if the formula(s) could adapt accordingly to every month but taking xx/01 fixed.

    Thank you to all for your kindness and attention

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,349

    Re: Adaptive formula for time shift

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is your forum profile showing the version of Excel that you need this to work for? 1808 is a number that I do not recognise.

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    05-05-2023
    Location
    Rome
    MS-Off Ver
    Office ProPlus 2019
    Posts
    6

    Re: Adaptive formula for time shift

    Dear Ali,

    I apologize for the mistakes.
    Thank you for your suggestions; I'll immediately correct the excel version and provide an example sheet.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,349

    Re: Adaptive formula for time shift

    Maybe this:

    =IF(DAY(B5)=1,EDATE(B5,12),EDATE(DATE(YEAR(B5),MONTH(B5),1),13))

    In Italian:

    =SE(GIORNO(B5)=1;DATA.MESE(B5;12);DATA.MESE(DATA(ANNO(B5);MESE(B5);1);13))
    Attached Files Attached Files
    Last edited by AliGW; 05-05-2023 at 07:02 AM. Reason: Workbook added.

  5. #5
    Registered User
    Join Date
    05-05-2023
    Location
    Rome
    MS-Off Ver
    Office ProPlus 2019
    Posts
    6

    Re: Adaptive formula for time shift

    Dear Ali,

    It works like a charm!

    I just need to adjust it for the second year forward (01/01/2020 --> 01/01/2022), but the formula is perfect.

    Thank you
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,349

    Re: Adaptive formula for time shift

    Sorry - should be this:

    =IF(DAY(B5)=1,EDATE(B5,24),EDATE(DATE(YEAR(B5),MONTH(B5),1),25))

    In Italian:

    =SE(GIORNO(B5)=1;DATA.MESE(B5;24);DATA.MESE(DATA(ANNO(B5);MESE(B5);1);25))

  7. #7
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Adaptive formula for time shift

    If A1=hired date, then =EOMONTH(A1,IF(DAY(A1)=1,23,24))+1

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,349

    Re: Adaptive formula for time shift

    See amendment in post #5.

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  9. #9
    Registered User
    Join Date
    05-05-2023
    Location
    Rome
    MS-Off Ver
    Office ProPlus 2019
    Posts
    6

    Re: Adaptive formula for time shift

    I will gladly do both, thank you again Ali

    Thank you also to josephteh: your solution was correct and valuable
    Last edited by good-deed; 05-05-2023 at 07:30 AM.

  10. #10
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Adaptive formula for time shift

    You are welcome, glad to be of help and thanks for the Rep!

+ 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. Formula for calculating lead time shift
    By cceze in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-29-2020, 05:56 PM
  2. Replies: 1
    Last Post: 07-13-2019, 01:12 PM
  3. [SOLVED] Formula to record 2:00 AM as a max end of shift time
    By Shellybelly in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-25-2016, 11:54 AM
  4. Need Help on Time Sheet Formula (Day Shift OK/Night Shift=Problem)
    By jomapac in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-18-2013, 02:26 AM
  5. [SOLVED] Formula for shading in regard to a time shift
    By MFSL in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-17-2012, 08:05 PM
  6. Day shift/night shift time calculation issue
    By STATEXCEL in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-31-2007, 08:48 AM

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