Convert Schedules to Interval Staffing

kamiljaku

New Member
Hey,

i want to convert a schedule into interval staffing with VBA. How to start this project?

1. Read the data into a array.
2. Calculate each shift duration.
3. ????


Please help me with some guidelines. I dont expect to receive here the full code but at least information what I need to google in the web.

Thanks in advance :)

 

tyija1995

Well-known Member
Hey,

Given the setup above the cells N7:T21 will be outputted with the given code:

Code:
Sub OutputTime()
    Dim i As Integer, j As Integer
        For i = 7 To 21
            For j = 14 To 20
                Cells(i, j).Formula = "=IFERROR(SUMPRODUCT((TIMEVALUE(LEFT(" & _
                Split((Columns(j - 10).Address(, 0)), ":")(0) & "$7:" & _
                Split((Columns(j - 10).Address(, 0)), ":")(0) & "$19,4))<=VALUE($M" & i & "))*(TIMEVALUE(RIGHT(" & _
                Split((Columns(j - 10).Address(, 0)), ":")(0) & "$7:" & _
                Split((Columns(j - 10).Address(, 0)), ":")(0) & "$19,5))>=VALUE($M" & i & "))),0)"
            Next j
        Next i
End Sub
 

ianbangxx

New Member
I wish to make this happen too using Google Sheets. This time, the source will be coming from a different sheet in the same file. What's going to be the formula?
 

Joe4

MrExcel MVP, Junior Admin
I wish to make this happen too using Google Sheets. This time, the source will be coming from a different sheet in the same file. What's going to be the formula?
Welcome to the Board!

Google Sheets is an entirely different beast than Excel, and there is no guarantee that those involved in this thread know how to do it in Google Sheets (or if they have even ever used Google Sheets before!).

I recommend you start a new thread on the topic, and post it to the "General Excel Discussion & Other Questions" forum (https://www.mrexcel.com/forum/general-excel-discussion-other-questions/), and be sure to make it very clear that you are looking for a Google Sheets solution. You can post a link back to this thread in your question, if you feel that may be helpful to people.
 

Some videos you may like

This Week's Hot Topics

Top