# Thread: Convert Schedules to Interval Staffing Thanks: 0 Likes: 0

1. ## Convert Schedules to Interval Staffing

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. ????

2. ## Re: Convert Schedules to Interval Staffing

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```

3. ## Re: Convert Schedules to Interval Staffing

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?

4. ## Re: Convert Schedules to Interval Staffing

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/genera...her-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.