+ Reply to Thread
Results 1 to 2 of 2

Closest workday occuring on, or before the 25th of the month

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    Excel 2010
    Posts
    1

    Closest workday occuring on, or before the 25th of the month

    Hi,

    I am trying to create a formula that gives me the WORKDAY that occurs on, or before the 25th of the month. I have to pay salaries on this date and it will be earlier if the 25th happens to fall on a weekend.

    Thanks,
    Craig.

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

    Re: Closest workday occuring on, or before the 25th of the month

    Given the 25th of the month as an input in cell A1,
    B1 will take that, and subtract 1 day if it happens to be a Saturday, and 2 days if it happens to be Sunday, and return the corresponding date.

    A1 = date_input
    B1 = A1 - MAX(0, WEEKDAY(A1, 3) - 4)

    The method is, WEEKDAY() returns 0 for Monday, 1 for Tuesday, ... 6 for Sunday, when we use "3" as the second term ("1" and "2" return different numbers); so we subtract 4, which makes Friday 0, Saturday 1, and Sunday 2; and if that's more than zero, it's subtracted from the date.

+ 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