Hi, so I am looking for a way to populate a list of those who meet certain criteria. This list is for employees will are required to stay and work over-time(mando). This is also cross-posted here and I did get a solution that wasn't VBA, but I would also like a VBA solution for it.
The way this works is they will call mando in a certain department from a specific employee. This means everyone below that employee is required to stay and work extra time. I have information off to the side starting in Column O where I would list my Mando specifications - Who it is posted for, the Lift time, and the Department (which is just a simple lookup formulas) that it is for. I show mando 1 and mando 2 to incorporate possibility of multiple mando times. I've included 2 scenarios in this sample file with the second one starting in Column U. Mind you in the actual file, I do not need any of scenario 2 incorporated into a macro - I would just erase Scenario 1's data and put any data from Scenario 2 in its place since it has Mando1 and Mando2. I just separated them in this instance to show different scenarios. here is a picture of what it looks like:
So what I am looking for is for a list of names to auto-populate in alphabetical order in Column O starting in Row 6. This would be a list of everyone in the department below an individual where the mando line was drawn. So in Scenario 1, let's say mando was posted for John Smith 8 for 6:30 PM in the C61C department. What I would expect to see based on that are the following names populating starting in Row 6:
John Smith 9
John Smith 11
John Smith 14
John Smith 15
That means these people (all of which are C61C dept. employees) were required to stay until 6:30PM. They had lower seniority than John Smith 8
Scenario 2 is a little more tricky and one department tends to do this more. They might have multiple mando lines. So in their case, let's say they posted mando for John Smith 10 at 8PM in the C65L department. They also posted another Mando Line for 9 PM for John Smith 17. This means under Mando 1 section, anyone from below John Smith 8 to and including John Smith 17's name would appear in that list. So that would be the following:
John Smith 12
John Smith 13
John Smith 16
John Smith 17
These employees(all of which are C65L Dept. employees) were all required to stay until 9PM. They had lower seniority than John Smith 10
And in the Mando 2 section, I would expect to see
John Smith 19
John Smith 20
These employees(again also C65L dept. employees) were required to stay until 10 PM. They had lower seniority than John Smith 17.
I assume that a function probably couldn't handle this and I thought maybe VBA might be able to. Also, the way I've laid out the mando specifications isn't set in stone, I am open to other suggestions on how to have it if it would make a macro work. It's just the Name, Lift time, and departments that are crucial points. I had also sorted beforehand the list by date order. Does this HAVE to be the case or could the macro look at the seniority date and figure that out? Is it possible to do this based on what I've shown?
The way this works is they will call mando in a certain department from a specific employee. This means everyone below that employee is required to stay and work extra time. I have information off to the side starting in Column O where I would list my Mando specifications - Who it is posted for, the Lift time, and the Department (which is just a simple lookup formulas) that it is for. I show mando 1 and mando 2 to incorporate possibility of multiple mando times. I've included 2 scenarios in this sample file with the second one starting in Column U. Mind you in the actual file, I do not need any of scenario 2 incorporated into a macro - I would just erase Scenario 1's data and put any data from Scenario 2 in its place since it has Mando1 and Mando2. I just separated them in this instance to show different scenarios. here is a picture of what it looks like:
So what I am looking for is for a list of names to auto-populate in alphabetical order in Column O starting in Row 6. This would be a list of everyone in the department below an individual where the mando line was drawn. So in Scenario 1, let's say mando was posted for John Smith 8 for 6:30 PM in the C61C department. What I would expect to see based on that are the following names populating starting in Row 6:
John Smith 9
John Smith 11
John Smith 14
John Smith 15
That means these people (all of which are C61C dept. employees) were required to stay until 6:30PM. They had lower seniority than John Smith 8
Scenario 2 is a little more tricky and one department tends to do this more. They might have multiple mando lines. So in their case, let's say they posted mando for John Smith 10 at 8PM in the C65L department. They also posted another Mando Line for 9 PM for John Smith 17. This means under Mando 1 section, anyone from below John Smith 8 to and including John Smith 17's name would appear in that list. So that would be the following:
John Smith 12
John Smith 13
John Smith 16
John Smith 17
These employees(all of which are C65L Dept. employees) were all required to stay until 9PM. They had lower seniority than John Smith 10
And in the Mando 2 section, I would expect to see
John Smith 19
John Smith 20
These employees(again also C65L dept. employees) were required to stay until 10 PM. They had lower seniority than John Smith 17.
I assume that a function probably couldn't handle this and I thought maybe VBA might be able to. Also, the way I've laid out the mando specifications isn't set in stone, I am open to other suggestions on how to have it if it would make a macro work. It's just the Name, Lift time, and departments that are crucial points. I had also sorted beforehand the list by date order. Does this HAVE to be the case or could the macro look at the seniority date and figure that out? Is it possible to do this based on what I've shown?