+ Reply to Thread
Results 1 to 6 of 6

Exclude Weekends in formulas involving dates

  1. #1
    Registered User
    Join Date
    07-12-2007
    Posts
    1

    Exclude Weekends in formulas involving dates

    Can anyone help me with a formula that would allow me to program cells with dates in which I add a certain number of days to the next cell for something to be worked on but don't want to include weekends, or be able to automatically add 2 to account for weekend days? I am doing this on an extended time line and don't want to have to manually account for the weekend days each time.

    ex. =A1+ 6 (where A1 is a date and the 6 goes over a weekend).

    thanks!!

  2. #2
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    I don't know of a formula that will do what you are wanting (doesn't mean that is doesn't exist), but I believe this VBA code will do it.

    It takes the date in cell A1, adds the number of days entered in cell B1 (excluding weekends), and then puts the end date in cell C1. You can probably easily modify this to fit your needs.
    Please Login or Register  to view this content.
    Sincerely,
    Jeff

  3. #3
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    rbruza,

    I thought a little more about your question and I believe this is more of what you are wanting to do. The function below should do what you are wanting to do. The code needs to go in a regular module in the VBA editor.

    On your worksheet you will use projdays(Start Date, Number of Days). Of course this can be a cell references where you have the date and number of days listed on your worksheet.
    Please Login or Register  to view this content.
    I have not dealt a whole lot with functions, but this appeared to work on my end. Hopefully, it will do what you are wanting it to do. Let me know what happens.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    If you have the Analysis Toolpak Addin installed (found under Tools|Addins)...

    then this formula should do it:

    =WORKDAY(A1,6)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    NBVC,

    Well, =WORKDAY(A1,6), is definitely the easier route to take.

    I did learn a little something about creating functions which I have not used a lot in the past and now I know about the workday function. I have learned two things today so I am blessed.

    This forum is definitely a wonderful thing.

  6. #6
    Registered User
    Join Date
    05-10-2019
    Location
    carol stream, il
    MS-Off Ver
    newest
    Posts
    15

    Re: Exclude Weekends in formulas involving dates

    Quote Originally Posted by NBVC View Post
    If you have the Analysis Toolpak Addin installed (found under Tools|Addins)...

    then this formula should do it:

    =WORKDAY(A1,6)
    I do have the Analysis Toolpack, but I have a question,

    I have dates that are generated from a report in my CRM (.csv file). Then we copy this file into an Analyzing Excel file that we have created. One of the objectives of this file is to count how many days have passed between 2 dates. Currently, the formula is as follows:

    =IF(ISERROR(DATEDIF($D4,$H4,"D"))," ",(DATEDIF($D4,$H4,"D"))) and then =IF(REPORT!I4=" "," ", IF(REPORT!I4>=3,1,0)) [I have some extra stuff in there to hid the erroneous values]

    These formulas are simply counting all days and not taking a 5 day business week into consideration.

    Is there a way to edit the existing formula to not include weekends?

    Hope you guys can help.

    Thanking you in advance!
    Last edited by LHARISIADIS; 05-14-2019 at 11:16 AM.

+ 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