+ Reply to Thread
Results 1 to 4 of 4

Dynamically calculate first and last pay periods for year

Hybrid View

  1. #1
    Registered User
    Join Date
    10-18-2011
    Location
    Centreville, VA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Dynamically calculate first and last pay periods for year

    I've been trying to figure out a calculation to determine the first and last pay periods in a year. Really I just need to figure out the last pay period for the year and I can calculate the first one for the next year by adding 14.

    This will be going into a calendar where I need to gray out the last couple of days of the year in the last pay period as it will actually carry over to the next year.

    I am looking for something like this, which gives me the start of the next pay period.
    =(MOD(DATE(2010,1,8)-TODAY(),14)+TODAY())+1

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,748

    Re: Dynamically calculate first and last pay periods for year

    I am assuming that 1/8/2010 is the last day of some pay period, because if the next pay period after today starts on 10/29/2011 (per your formula), a pay period started on 1/9/2010. I am also assuming that a pay period is 14 days.

    You haven't defined what you mean by the last pay period of the year. This gives you the last pay period that ends in the current year:
    =(MOD(DATE(2010,1,8)-DATE(YEAR(TODAY()),12,5),14)+DATE(YEAR(TODAY()),12,5))+1
    This gives you the last pay period that starts in the current year:
    =(MOD(DATE(2010,1,8)-DATE(YEAR(TODAY()),12,17),14)+DATE(YEAR(TODAY()),12,17))+1
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Dynamically calculate first and last pay periods for year

    Can you just change the 'TODAY()'s to 'DATE(2012,1,1) and then subtract your 14?

    Pauley

  4. #4
    Registered User
    Join Date
    10-18-2011
    Location
    Centreville, VA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Dynamically calculate first and last pay periods for year

    Quote Originally Posted by Pauleyb View Post
    Can you just change the 'TODAY()'s to 'DATE(2012,1,1) and then subtract your 14?

    Pauley
    This is actually kind of what I figured out. I wasn't wrapping my single braincell around it at first.

    I actually meant to ask about this for VBA and this is what I came up with

    ((DateSerial(2010, 1, 8) - DateSerial(bYear + 1, 1, 1)) Mod 14) + DateSerial(bYear + 1, 1, 1)
    bYear refers to a cell that contains the year, the +1 gives me next year.

    Thanks for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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