+ Reply to Thread
Results 1 to 7 of 7

Excluding Weekends in a IF function

  1. #1
    Registered User
    Join Date
    01-14-2019
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Excluding Weekends in a IF function

    Morning All,

    I'm looking for some help with building a formula.

    I have a spreadsheet that determines a date dependent on a certain criteria. For example, if a specific column displays "Exempt" - then the result will be the same as the date two rows above (same column). However, if it doesn't display exempt, it will take the same date (two rows above) and add on the sum in another column.

    My issue is this; how do I get it to exclude Weekends? I've seen formulas such as WEEKDAYS and NETWORKDAYS however I'm not sure how to include it into my current formula.

    At the moment my FORMULA looks like this =IF(NOT(X13="EXEMPT"),(DATE(YEAR(R11),MONTH(R11),DAY(R11)+(Q13+1))),IF(X13="EXEMPT",R12))

    All help is greatly appreciated.

    Thanks in advance.

  2. #2
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    354

    Re: Excluding Weekends in a IF function

    I think you want to use WORKDAY -- modifying your existing formula, which doesn't appear to align to your narrative, perhaps:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    so the above will add n days (Mon-Fri) to your date in R11.

  3. #3
    Registered User
    Join Date
    01-14-2019
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Excluding Weekends in a IF function

    Thanks for your response XLent.

    Howabout if I want to add the WORKDAY to the IF(NOT(X13="EXEMPT") part? how would I work in the workday formula without disrupting the YEAR, MONTH, DAY, format?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2003,2007,2010
    Posts
    27,618

    Re: Excluding Weekends in a IF function

    Unusual way to write an IF formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    It can be just
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Not sure how you want to exclude weekend dates. Probably best to post a sample workbook with some worked examples ... what result do you actually want?


    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Excel Aid

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    354

    Re: Excluding Weekends in a IF function

    Quote Originally Posted by zakallen View Post
    Thanks for your response XLent.

    Howabout if I want to add the WORKDAY to the IF(NOT(X13="EXEMPT") part? how would I work in the workday formula without disrupting the YEAR, MONTH, DAY, format?
    I would suggest testing the solution provided against your current formula, not forgetting to format the cell as a date.

  6. #6
    Registered User
    Join Date
    01-14-2019
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Excluding Weekends in a IF function

    Hi,

    I've attached the spreadsheet.

    I'm looking at Column R. I've got two testing machines and for no.1 and no.2 the next Unique ID cannot be tested until its Testing bay is available. IE. REF0005 can't commence testing until REF0003 has finished as they are both on the same Test bay.
    I just need to work out a formula for Column R, which will say for example, 'For testing bay 1, if Column T doesn't show Exempt for a SKU, then it will return the completion date of the last SKU on the same testing bay. But this cannot be a weekend.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    10-13-2010
    Location
    UK
    MS-Off Ver
    various
    Posts
    354

    Re: Excluding Weekends in a IF function

    Hi, sorry for belated response, I'll confess that I can't quite follow the above narrative -- all I can say is that the below:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    can be re-written as below - if adding the days on a Mon-Fri basis

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    so the above would return Thu 31st January rather than Sun 27th January as it will ignore weekends when adding the 9.69* days to the date in R2.

    If you want it to add the 9.69* days ignorant of days of week and then ensure it lands on a workday (i.e Mon 28th) you can use

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    However, I suspect you want the first suggestion?

+ 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