Shift Schedule patterns

  • Good day everyone,


    I working on a big shift schedule where the crew are working 4 days by 4 days.


    The Shift has a pattern like : N N N N O O O O D D D D, N for Night, D for Day & O for Off.


    other shift has the opposite pattern like: D D D D O O O O N N N N


    what i need is a macro that help me to generate and auto fill the rest of the cells of the month or maybe the year if I only typed one letter in any cell


    WHAT I THINKING ABOUT IS THE FOLLOWING:


    let say i wrote KN3 which mean "START FROM THE 3 NIGHT"; the rest of cell have to continue the pattern like: N N O O O O D D D D N N N N .....



    my code is


    The problem that I facing now is whenever I typed "KN1" in "SHIFT SCHEDULE" sheet, The pattren " N N N N ...." is being repeated in "list" sheet


    Sheet 1= "SHIFT SCHEDULE" , Sheet 2 = list


    Also, instead of specifying the Range like I did above (e.g. Range (F13:I13) )


    I want it to be a general column/row range.


    attached the my Excel sheet.


    regards.

  • Re: Shift Schedule patterns


    I did this with a formula, and a "seed" of the shift for the 1st 3 days...
    [Table="width:, class:grid"]

    [tr][td][/td][td]

    A

    [/td][td]

    B

    [/td][td]

    C

    [/td][td]

    D

    [/td][td]

    E

    [/td][td]

    F

    [/td][td]

    G

    [/td][td]

    H

    [/td][td]

    I

    [/td][td]

    J

    [/td][td]

    K

    [/td][/tr]


    [tr][td]

    1

    [/td][td][/td][td]

    1

    [/td][td]

    2

    [/td][td]

    3

    [/td][td]

    4

    [/td][td]

    5

    [/td][td]

    6

    [/td][td]

    7

    [/td][td]

    8

    [/td][td]

    9

    [/td][td]

    10

    [/td][/tr]


    [tr][td]

    2

    [/td][td][/td][td]

    N

    [/td][td]

    N

    [/td][td]

    N

    [/td][td]

    N

    [/td][td]

    O

    [/td][td]

    O

    [/td][td]

    O

    [/td][td]

    O

    [/td][td]

    D

    [/td][td]

    D

    [/td][/tr]


    [tr][td]

    3

    [/td][td][/td][td]

    O

    [/td][td]

    O

    [/td][td]

    O

    [/td][td]

    O

    [/td][td]

    D

    [/td][td]

    D

    [/td][td]

    D

    [/td][td]

    D

    [/td][td]

    N

    [/td][td]

    N

    [/td][/tr]


    [tr][td]

    4

    [/td][td][/td][td]

    D

    [/td][td]

    D

    [/td][td]

    D

    [/td][td]

    D

    [/td][td]

    N

    [/td][td]

    N

    [/td][td]

    N

    [/td][td]

    N

    [/td][td]

    O

    [/td][td]

    O

    [/td][/tr]


    [/table]

    B2:D2 = the seed for that rotation (start all rows with this)
    E2=IF(A2="",D2,IF(A2="N","O",IF(A2="O","D","N")))
    copied across and down


    I think there will be a problem if you start a new month in column B again, but we can probably add a work-around for that, if needed

    Regards


    Ford

  • Re: Shift Schedule patterns


    Thanks, I found the solution.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!