Looping Through Values with Index/Match for schedule creation

Johncapov

New Member
Joined
Mar 2, 2020
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
I'm creating a schedule that loops through a list of approver/preparer names. The goal is to have each individual evenly distributed throughout the list on different days which I have accomplished.

However, the last objective I have is to make it so if the preparer or approver on duty is on vacation that day it will automatically switch to the next available person within the list. Note the preparer can not be the same as the approver.

Is there a way to complete this with a function? I'm very close but cant figure out how to make it so it looks at the 3 different people that are out on vacation and grabs the next person who is available.

Here are the formulas I have so far which rotates the list as needed but does not take into account if the person is out of the office the Vacation validation section was my attempt at seeing whether that person was out of the office, however I believe all of this could be coupled into one function/vba solution?:

Preparer Column: =IF(H3<>"NO","HOLIDAY",IF(OR(WEEKDAY(A3)={1,7}),"WEEKEND",IF(MATCH(F3,B3:D3,0),OFFSET('Input Data (For Schedule Prep)'!$C$2,MOD((ROW(A2)-3),COUNTA('Input Data (For Schedule Prep)'!C:C)-3),0),IF(AND(WEEKDAY(A3)<>{3,5},(K3="Yes")),'Input Data (For Schedule Prep)'!$G$2,OFFSET('Input Data (For Schedule Prep)'!$C$2,MOD((ROW(A2)-1),COUNTA('Input Data (For Schedule Prep)'!C:C)-1),0)))))

Approver Column: =IF(H3<>"NO","HOLIDAY",IF(OR(WEEKDAY(A3)={1,7}),"WEEKEND",IF(G3=D3,OFFSET('Input Data (For Schedule Prep)'!$C$2,MOD((ROW(A1)+1),COUNTA('Input Data (For Schedule Prep)'!C:C)-1),0),OFFSET('Input Data (For Schedule Prep)'!$C$2,MOD((ROW(A1)-2),COUNTA('Input Data (For Schedule Prep)'!C:C)-1),0))))

1589832324653.png


1589832302349.png
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You are far more likely to get a response if instead of posting Pictures, which require someone to recreate all the data manually, you post the sample data, this allows it to be copied and pasted and worked on. Use the XL2BB to post the data sample.
 
Upvote 0
Okay, my apologies I'm new to this forum. I think I found a alternative just involves looping through a range.

Essentially I would like to keep adding 1 to each value in column F until the value to the left in Column E = 0. Then go to the next in the column until all of the populated values = 0. In column E and D there is a formula that references that and looks to see if that person is Out Of the Office. Would this be a vba solution? The code below is a starting point but doesn't skip to each row in column F.


1591825507714.png


Sub FillDown()
Dim xRng As Range
Dim xRows As Long, xCols As Long
Dim xRow As Integer, xCol As Integer
Set xRng = Selection
xCols = xRng.Columns.CountLarge
xRows = xRng.Rows.CountLarge
For xCol = 1 To xCols
For xRow = 1 To xRows - 1
If xRng.Cells(xRow, xCol) <> "" Then
xRng.Cells(xRow, xCol) = xRng.Cells(xRow, xCol).Value
If xRng.Cells(xRow + 1, xCol) = "" Then
xRng.Cells(xRow + 1, xCol) = xRng.Cells(xRow, xCol).Value
End If
End If
Next xRow
Next xCol
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top