none
Set working time in shift 4 working days (7am-7pm) 2 days off RRS feed

  • Question

  • I would like to set working time for his project team in shift. One shift contains only 4 working days from 7am-7pm and 2 days off. The other shift is also the same but night shift 7pm-7am. How could we set the working time not based on Mon-Sun but the number of days instead? Please advise how to set up it.

    Thank you.

    Thursday, December 17, 2015 7:05 AM

Answers

  • Hope this works (save image to your disk and then view it with a picture viewer for full size)...


    Ismet Kocaman | Learn Formulas | Articles | Connect


    Tuesday, December 22, 2015 12:55 PM
  • Arintra,

    A similar question was raised in this forum a while back (Ref, https://social.technet.microsoft.com/Forums/en-US/77e4548b-af84-4685-b537-b47de8717d3e/custom-calendar-schedule-is-a-14-days-on14-days-off-cycle-not-manually-entered-possible-in?forum=projectprofessional2010general.

    In order to more easily set up the "days on, days off" sequence I wrote a small macro to do that. It is certainly more convenient than doing it all manually. Herewith is the macro, you will need to modify it for your needs, but at least it gives a starting point.

    John

    Sub Dayson_Daysoff_calendar()
    'This macro will create a 14 days on/14 days off sequence
    'It is based on a copy of an existing 7 day workweek calendar with default work time (8am to 5pm with 1 hour lunch)
    'The number of exceptions is arbitrarily set at 25. That will cover just short of 2 years
    'Macro written by John-Project June 24, 2015
    Dim SD As Date
    Dim FD As Date
    Dim Seed As String
    Dim i As Integer
    'first create the new custom calendar
    On Error Resume Next    'in case the custom calendar already exists
    BaseCalendarCreate Name:="14on-14off", FromName:="7-day week"
    On Error GoTo 0
    'Ask user for the date to start the 14on/14off sequence
    '   if no date is entered assume current date
    Seed = InputBox("Enter sequence start date as mm/dd/yy")
    If Seed = "" Then Seed = ActiveProject.CurrentDate
    'add 13 days + 9 hours to arrive at a finish of 5:00 pm
    FD = DateAdd("h", 321, Seed) 'add 14 days to the start date
    For i = 1 To 25
        ActiveProject.BaseCalendars("14on-14off").Exceptions.Add Type:=1, Start:=Seed, Finish:=FD, Name:="exception " & i
        Seed = DateAdd("d", 28, Seed)   'sets start of next group 28 days later at 8:00 am
        FD = DateAdd("h", 321, Seed)    'sets finish of next group 13 days later at 5:00 pm
    Next i
    End Sub


    Sunday, December 27, 2015 3:50 PM

All replies

  • Does the article at https://support.office.com/en-us/article/Change-working-days-for-the-project-calendar-323ff403-a676-428c-be11-6942bfb7210c?ui=en-US&rs=en-US&ad=US&fromAR=1 help?

    --rms www.rmschneider.com

    Thursday, December 17, 2015 9:42 AM
  • You could do this but not using the normal Work Weeks functionality in Project Pro.

    I think you would need to manually set this up with exceptions.

    Setup a calendar where the work week is 7 days a week 7am-7pm.

    Then manually setup your days off as exceptions. I played around with it and you cant do recurring exceptions because they would overlap and Project has an issue with that.


    Brian Kennemer - Project MVP Principal Architect Projectified Consulting

    Monday, December 21, 2015 5:47 PM
    Moderator
  • Hope this works (save image to your disk and then view it with a picture viewer for full size)...


    Ismet Kocaman | Learn Formulas | Articles | Connect


    Tuesday, December 22, 2015 12:55 PM
  • Thank you, Rob. I had tried the standard features before but couldn't resolve it.
    Sunday, December 27, 2015 5:08 AM
  • Thank you, Brian. So, we need to continuously manually set the 2 days off, don't we? I did think about this before and wondered whether any other shortcut as setting the 2 day-off seems to be forever activity for 10 year project.
    Sunday, December 27, 2015 5:18 AM
  • Hi Ismet, Thank you for the solution. This means you bundle working time in the tasks. If the tasks are not in 4-day chunk, we need to split them to be 4-day slot, don't we? Please advise.
    Sunday, December 27, 2015 5:29 AM
  • Arintra,

    A similar question was raised in this forum a while back (Ref, https://social.technet.microsoft.com/Forums/en-US/77e4548b-af84-4685-b537-b47de8717d3e/custom-calendar-schedule-is-a-14-days-on14-days-off-cycle-not-manually-entered-possible-in?forum=projectprofessional2010general.

    In order to more easily set up the "days on, days off" sequence I wrote a small macro to do that. It is certainly more convenient than doing it all manually. Herewith is the macro, you will need to modify it for your needs, but at least it gives a starting point.

    John

    Sub Dayson_Daysoff_calendar()
    'This macro will create a 14 days on/14 days off sequence
    'It is based on a copy of an existing 7 day workweek calendar with default work time (8am to 5pm with 1 hour lunch)
    'The number of exceptions is arbitrarily set at 25. That will cover just short of 2 years
    'Macro written by John-Project June 24, 2015
    Dim SD As Date
    Dim FD As Date
    Dim Seed As String
    Dim i As Integer
    'first create the new custom calendar
    On Error Resume Next    'in case the custom calendar already exists
    BaseCalendarCreate Name:="14on-14off", FromName:="7-day week"
    On Error GoTo 0
    'Ask user for the date to start the 14on/14off sequence
    '   if no date is entered assume current date
    Seed = InputBox("Enter sequence start date as mm/dd/yy")
    If Seed = "" Then Seed = ActiveProject.CurrentDate
    'add 13 days + 9 hours to arrive at a finish of 5:00 pm
    FD = DateAdd("h", 321, Seed) 'add 14 days to the start date
    For i = 1 To 25
        ActiveProject.BaseCalendars("14on-14off").Exceptions.Add Type:=1, Start:=Seed, Finish:=FD, Name:="exception " & i
        Seed = DateAdd("d", 28, Seed)   'sets start of next group 28 days later at 8:00 am
        FD = DateAdd("h", 321, Seed)    'sets finish of next group 13 days later at 5:00 pm
    Next i
    End Sub


    Sunday, December 27, 2015 3:50 PM
  • Hi Ismet, Thank you for the solution. This means you bundle working time in the tasks. If the tasks are not in 4-day chunk, we need to split them to be 4-day slot, don't we? Please advise.

    You're welcome. 

    Considering the schedule above; you can assign resources to the tasks by ignoring resource calendars. Use the Resource Sheet view for the work values. 

    Alternatively, you can assign resources using those calendars as base calendars to the tasks; in this case, do not apply task calendars to the tasks and do not ignore the resource calendars. 

    Tasks with no resources can be used to indicate the days with no work, instead of lags. 

    You can enter any duration to the tasks; just use hours for the duration unit if a day is not 12 hours. 

    If all these seem difficult to implement manually, then I would suggest a VBA solution. John's solution looks like a feasible one, as always, so please consider to implement it. 





    Ismet Kocaman | Learn Formulas | Articles | Connect

    Sunday, December 27, 2015 9:50 PM
  • Thank you, John! I have tried your original code to see how it works. It shows error as below. Not sure if I have done anything wrong in setting up the macro in the project. I can't code. Please advise.

    The error message says "Run-time error '1101':. Application-defined or Objected-defined error."


    • Edited by Arintra Wednesday, January 20, 2016 6:36 AM
    Wednesday, January 20, 2016 6:34 AM
  • Arintra,

    The code requires the existence of a project calendar called "7-day week" to exist in the active project (see second comment in macro header). Without that calendar, you will receive the exact error message you see. The macro could have been written to customize the default "standard" calendar but since the basic idea is to have a modified version of a two shift calendar that runs for all 7 days of the week, I elected to start with a 7-day week calendar. I find a 7 day version of the standard calendar to be useful for other projects anyway.

    To correct the error, I suggest you first create a 7 day calendar named "7-day week" using the work shift hours you want. Then use the Organizer to transfer that calendar from the Global to your active project. Note, I don't use the web based version of Project so I don't know if new calendars are automatically created in the active project or not with that version. Once that 7-day week calendar is resident in the project, the macro should run without problems. If not, let me know and we'll tackle the next issue.

    John

    Wednesday, January 20, 2016 4:13 PM
  • I am sure John's VBA works a treat. I haven't tried it yet but I will.

    Wasn't your original question "4 working days from 7am-7pm and 2 days off".
    The easy part is making a 7 days/week calendar 07:00 - 19:00.
    I Just copy the standard calendar and make the copy called "AA 7 Days, 12 Hours, 7am to 7pm"
    The hard part, or rather the tedious part, is making the 2 day exceptions after every 4 days working.
    You need a starting date and this is a six day cycle, so in a year there is about 60 or 61 of them.
    In 10 years there is 600 or so.

    When you make a few of the two days exceptions and record a macro, you get this, which shows the syntax:

    ActiveProject.BaseCalendars("AA 7 Days, 12 Hours, 7am to 7pm").Exceptions.Add Type:=1, Start:="25/02/2016", Finish:="26/02/2016", Name:="25th, 26th February 2016"

    ... and then you need to define and provide start and finish and name as variables and increment the loop.

    The line in the John's macro which does this is:

    ActiveProject.BaseCalendars("14on-14off").Exceptions.Add Type:=1, Start:=Seed, Finish:=FD, Name:="exception " & i

    Wednesday, January 20, 2016 11:14 PM
  • Sub ExceptionCycle()
    'Macro ExceptionCycle
    'This macro will create a 2 days off, 4 days on cycle
    'It is based on a copy of an existing 7 day workweek calendar with default work time 07:00 - 19:00
    'The number of exceptions is arbitrarily set at 25.
    'Macro written by Trevor 21 January 2016
    Dim SD As Date
    Dim FD As Date
    Dim Seed As String
    Dim i As Integer
    'first create the new custom calendar
    On Error Resume Next    'in case the custom calendar already exists
    BaseCalendarCreate Name:="AA 7D 12H 07-19 ver1", FromName:="AA 7D 12H 07-19"
    On Error GoTo 0
    'Ask user for the date to start the 2 days off, 4 days on cycle
    '   if no date is entered assume current date
    Seed = InputBox("Enter sequence start date as dd/mm/yyyy")
    If Seed = "" Then Seed = ActiveProject.CurrentDate
    'add 1 day to arrive at a finish on the next day 19:00
    FD = DateAdd("d", 1, Seed) 'add 1 day to the start date to get the first exception finish date
    For i = 1 To 25
        ActiveProject.BaseCalendars("AA 7D 12H 07-19 ver1").Exceptions.Add Type:=1, Start:=Seed, Finish:=FD, Name:="exception " & i
        Seed = DateAdd("d", 6, Seed)   'sets start of next group on 7th day later at 7:00 am
        FD = DateAdd("d", 1, Seed)    'sets finish of next group 2nd day later at 19:00 pm
    Next i
    End Sub
    Thursday, January 21, 2016 1:30 AM
  • Thursday, January 21, 2016 8:11 AM
  • John,

    Can you tell me how does this macro work please 

    I want to change this macro for my calender

    Wednesday, December 7, 2016 12:37 AM
  • Meteor,

    The macro code you see earlier in this thread is the one I wrote. I didn't Know that Trevor modified it and then claimed it as his own. I don't appreciate that.

    As I stated in your other post, I will modify the code to do what you need and post it there.

    John

    Wednesday, December 7, 2016 2:31 PM
  • He didnt actually. He was replying to a question here and modified your code. I dont think there was any intention to deceive. :-)

    Brian Kennemer - Project MVP | Principal Architect | Projectified Consulting

    Wednesday, December 7, 2016 4:18 PM
    Moderator
  • Brian,

    I understand that but I don't think it is appropriate to take ownership of the entire macro as something he wrote but instead include a comment that it is a modified form of the macro I wrote. That's what I do if I tweak somebody's posted code and re-post it. I like to think of it as professional courtesy.

    John

    Wednesday, December 7, 2016 6:08 PM