+ Reply to Thread
Results 1 to 7 of 7

Formula for days until next payday

  1. #1
    Registered User
    Join Date
    12-22-2016
    Location
    UK
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Formula for days until next payday

    I'd like a formula to calculate the number of days until next payday.

    I get paid monthly on the 25th, however, if the 25th falls on a weekend or UK bank holiday, I get paid on the Friday.

    I did think a table would help.
    A Day (starts Monday)
    B Date (starts Dec 23, 2019)
    C Month (starts Jan-20) (NB I use payday to determine the next period, so Jan-20 runs from Dec 23, 2019 until Jan 23, 2020 etc.)
    D Week (starts 1)
    E Payday (Yes or No)

    Today is Saturday Jul 25, 2020 and I was paid yesterday. My next payday will be Tuesday Aug, 25, 2020.

    I then though an Index and Match function would work, but not sure how to reference the match without writing a formula and changing it every month anyway.

    I've seen this,
    =DATE(YEAR(TODAY()),MONTH(TODAY())+(DAY(TODAY())>25),25)-TODAY()
    but the formula just returns an error

    Any help would be much appreciated.

  2. #2
    Forum Contributor
    Join Date
    07-16-2015
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Formula for days until next payday

    Try

    =DATEDIF(Date1,Date2,"D") Date 1 being the earlier date

  3. #3
    Registered User
    Join Date
    12-22-2016
    Location
    UK
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: Formula for days until next payday

    Thanks for your prompt reply. I can enter Date1 as Jul 24, 2020 in, say, C1 and Date2 as Aug 25, 2020 in C2 and write this formula but it would need to be re-written every month and I'm trying to avoid that.
    =DATEDIF(C1,C2,"D")

  4. #4
    Forum Contributor
    Join Date
    07-16-2015
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Formula for days until next payday

    You can enter

    =DATEDIF(TODAY(),C2,"D") Otherwise provide an example sheet so we can see exactly what you require.

  5. #5
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Formula for days until next payday

    This is an interesting logical challenge. I broke it down into a couple of parts:

    In cell A1 is the input date.
    Please Login or Register  to view this content.

    In cell A2 is the 25th of the month from after today.
    Please Login or Register  to view this content.
    (Note that you can put TODAY() instead of the "A1" there, I made it a reference so I could manually enter things in A1 for testing).
    Note that DATE(2020, 13, 25) is resolved as "Jan 25, 2020" so that will handle rolling over into the next year for us automatically.


    In cell A3 we have a weekend handler
    Please Login or Register  to view this content.
    This will resolve as 1 if A2 is a Saturday or a 2 if A2 is a Sunday.


    In cell A4 we have a holiday handler
    Please Login or Register  to view this content.
    This will return 1 in two cases:
    1) A2 itself is a holiday.
    2) If A2 - A3 (eg, the presumptive next payday) is a holiday. (To handle a case where the 25th is on the weekend but the 23rd or 24th, for whatever reason, is a bank holiday and we need to pull payday forward to Thursday).
    Note this is assuming a manually entered range of Bank Holidays in cells D1:D10, with each holiday given it's own cell. If you already have that somewhere else in your spreadsheet you can point there instead.


    In cell A5 is the date of the next payday
    Please Login or Register  to view this content.
    Note that because of the choice in A2 to check for dates greater than the 25th, this will tell you that "today" is the next payday when A1 =August 25th, 2020.
    If you wanted it to instead say that the next payday is September 25th, you'd put a ">=" instead of a ">" in the "DAY()>A1" term in cell A2.


    Finally in Cell A6 is The Output, "Days until Next Payday"
    Please Login or Register  to view this content.
    If you dropped the "A1=TODAY()" cell usage you can just make it "=A5-TODAY()" instead
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  6. #6
    Registered User
    Join Date
    12-22-2016
    Location
    UK
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: Formula for days until next payday

    Ok, So I have created a VLOOKUP on one sheet which gives me the last instance of salary
    =LOOKUP(2,1/(C:C="Salary"),A:A)
    where column G contains categories and column A contains dates.

    This gives me a working Date1 cell reference.

    I've attached a basic worksheet to demonstrate what I'm trying to achieve
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-22-2016
    Location
    UK
    MS-Off Ver
    Microsoft 365
    Posts
    13

    Re: Formula for days until next payday

    Thanks this has worked - because today is incidentally 25th, your remarks about adding ">=" to the formula in cell A2 made this work!

+ 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. Replies: 1
    Last Post: 05-15-2019, 03:33 PM
  2. The next payday
    By paulikk in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 01-19-2016, 11:30 AM
  3. Show days until payday
    By Excelian1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-13-2015, 08:11 AM
  4. Days until Payday
    By brucey2343 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-17-2013, 12:58 PM
  5. APR on Payday Loans
    By midds in forum Excel General
    Replies: 3
    Last Post: 06-14-2011, 04:23 AM
  6. Payday formula
    By Prospero in forum Excel General
    Replies: 4
    Last Post: 02-27-2005, 07:34 PM
  7. [SOLVED] can anyone help me with a payday calculator?
    By cube in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-07-2005, 12:06 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