![]() |
Asking for better logic to avoid multiple if's.
I have been trying to find a better method to loop through the data
than a series of if statements. What I am trying to do is go down a list of employees and determine which preference they were able to fit into and subtract that from a set value.. If we started with 1 in each time frame from 6:00AM to 2:00PM in two hour increments the following data would end up as listed below. Name Full/Part Rank 1 2 3 4 5 Student A Full 1 8:00 AM 10:00 AM 6:00 AM 12:00 PM 2:00 PM Student B Full 2 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM Student C Full 4 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM Student D Full 5 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM Student E Full 6 12:00 PM 10:00 AM 8:00 AM 6:00 AM 2:00 PM Assigned Student A 8:00 AM - First preference and a slot available so it's filled. Student B 6:00 AM - First preference and a slot available so it's filled. Student C 10:00 AM - First two preference are already completed filled so 3rd is used. Student D 12:00 PM - First three preferences are already filled so 4th is used. Student E 2:00 PM - First four preferences are already filled so 5th is used. On the full list there are a varying number of slots available in each time slot. What I was beginning to do so far was loop across checking each slot for availability then moving on to the next one if there was none or subtracting one and going to the next employee. I could continue this way but it would end up being close to 25-30 if statements and I'm just asking if there is better logic to use here than that. Any ideas would be appreciated. Excel 2003 is the version being used. Thanks! |
All times are GMT +1. The time now is 02:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com