+ Reply to Thread
Results 1 to 14 of 14

Need Help Assigning Jobs to Students

  1. #1
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Need Help Assigning Jobs to Students

    In my department we have a laptop setup with Excel 2007 so that a student can walk in, scan his ID with a barcode scanner, and then be counted for attendance. This was very simple with the VLOOKUP formula. However, I have now been assigned the task of setting up a similar program only now I must make it so when the student scans his/her ID then it will give that student a random job.

    I have three major problems when it comes to this:
    1. I can't have jobs assigned to a student who is not there
    2. I prefer the jobs be random, but cannot be given consecutively and must be evenly distributed

    There are 25 students total that need to be involved, 13 juniors and 12 seniors with 8 jobs that need to be assigned. I will attach my template although I am able to be flexible on the setup.
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Need Help Assigning Jobs to Students

    You just have to add a random generator function in your actual macro that will assign a job to the student being processed.
    Is there a difference between junior and senior student about job assigment?
    Having only 8 jobs, same job can be allocated to more than one student. Is that OK?
    As a job is assigned when the student scan his/her ID card, I see no issue as per #1. Jobs would be assigned on the fly.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    There is no difference between the junior and senior class. The junior class will come in the morning, scan their IDs, and then receive a job. The senior class will then come in two periods later, scan their IDs, and receive their job. With there being more students there obviously has to be more or repeated jobs. Jobs 1, 2, and 3 will be given to two students during that period while there will be one or two assistant jobs as well. I now have it set up so that Column C will use the VLOOKUP function to look up the name associated with the ID. Then I have another table setup with their name matching a job with a macro that will randomize that list of jobs each day so everytime the student scans their ID, a new job will be associated with the student's name. Although my issues arise when jobs are randomly consecutive and with the code I have, it will randomize the whole column without separating juniors from seniors. I will upload the template so I can get a few opinions on what to do.

    Basically I need help with making sure the jobs are not assigned to the same person within a week period as well as changing the existing macro to only randomize B1:B12: and B14:B26.

    I appreciate any help or effort, thank you.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    Ignore the last template. All I need to fix now is the consecutive job assigning.

    A template is attached.

    Thank you for all of the help.

  5. #5
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    Thank you for all your help.
    Attached Files Attached Files

  6. #6
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Need Help Assigning Jobs to Students

    I see this more like a database and being so I would suggest to use either a special entry sheet or a userform where the student would scan his/her card and be assigned a job. The macro would look at the jobs numbers to be assigned this week and it will make sure a job is not assigned twice to the same student.

    Then this data is transfered to the database sheet.
    You still need your Id and Name sheet for cross reference.
    Jobs numbers should be incremented all the time and you would have to specify which jobs numbers are to be assigned this week or for a certain period of time.

    What do you think of this proposition?

  7. #7
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    I am open to any ideas for this project but unfortunately I do not have enough experience to go about accomplishing your proposition.

    If you find any free time where you could make an example or something that I can implement into my project, it would be much appreciated. If not, no worries. I am at the point where what I have may have to be acceptable since other projects require my attention.

    All help is much appreciated.

  8. #8
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Need Help Assigning Jobs to Students

    Hi,
    here is a workbook that might help you.
    I think it does all you wanted but the format may be a little bit different.

    All sheets are protected and the password is password. You'll probably want to change it to a better one. No problem as long as you change it in the VBA code too. Don't forget to change the password at all the places in the VBA code.

    I inserted lots of comments in the code so you should be able to understand what I did.

    The way I programmed this, your job numbers should not repeat. They have to be integer numbers. You unprotect the sheet "SingIn" and you put the lowest and the largest job number to be assigned in the specially named cells. The macro will assign a job number equal to or larger than the MINIMUM and equal to or less than the MAXIMUM.

    When all the jobs (say from 1 to 8) have been assigned, you changed the values to say 9 to 20 or so and you are back on business.

    In the database sheet, I'm using 3 cells at the right of the data table to check if a job was already assigned to a student. The macro will write to the first 2 cells and look at the value of the third one to know if the job selected can be assigned to the student.

    I hope this will help you
    I also hope your students will like it too.
    Attached Files Attached Files
    Last edited by p24leclerc; 12-14-2012 at 10:21 PM.

  9. #9
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    Thank you very much!

    I love the look of that and the functionality, but unfortunately I am unable to use a template like that.
    I'm stuck with the template I was given and I am very close to having every function work as I want it to, but I do really appreciate the effort given into this assignment.

  10. #10
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    I have finally assembled exactly what I need for this project but I have a few issues getting it to work correctly.

    Here's what is exactly happening:
    1. I type a student ID in A2. It will return the Date and the Name but I get the error message "Could not set array: 'Tasks.' This action has been abandoned," for the Job.
    2. I type student IDs in A3:A6. Everything returns perfectly.
    3. I type a student ID in A7. It will return the Date and the Name but I get the error message "Job assignment failed. This action has been abandoned," for the Job.
    4. I type a student ID in A8. Everything returns.
    5. Every ID I enter after A8 returns "Job assignment failed. This action has been abandoned."
    ALSO, if I enter the ID in A3 that I enter in A2, Excel will go into a loop that I must force close.

    I really would like this program to work so all help is much appreciated. A template is attached.
    Attached Files Attached Files

  11. #11
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Need Help Assigning Jobs to Students

    Hi,
    Pretty complex programming here. I had a hard time with it.
    I found couple of issues though it does not solve all of it.
    First, I think you should add a condition in this loop:
    Please Login or Register  to view this content.
    This prevents error because your code is trying to evaluate date in row 1 where there is none.
    I added this condition to the following Subs or Functions: SetTasks, AdjustTaskerPoints, CountArrivals

    Secondly, in NextTask, I specified the dimension in the Ubound function in the Do While Loop.
    Please Login or Register  to view this content.
    As Ubound(Tasks) is 1, Jn Mod Ubound(Tasks) was always giving the same answer.

    Now, The issue I have is that after assigning all tasks (12) the system does not assign any other task. I think Tasks() should be somehow reset. Not sure at all how to do this.
    Hope this help you
    Regards

  12. #12
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    Hello Pierre,

    I thank you very much for taking your time to try to understand this code and fix it. Unfortunately I did not see your post until fixes have already been made, but if you want to take another look so I can have another brain try to locate the next problem, I would much appreciate it.

    My problem now is when I reach row 15. All cells work perfectly until I reach this row where it won't return the job and I am unsure why. (It occurs with every row after row 15 as well.) I will attach a template and if you have any solutions, let me know or just implement them into the project and attach it. Thank you.
    Attached Files Attached Files

  13. #13
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Need Help Assigning Jobs to Students

    I know about this issue as I mentionned it in my last post.
    You have 13 jobs to assign and when all are assigned, all of the array Tasks() is TRUE telling your program that there is no more job to assign.
    You have to reset Tasks() array so you can continue assigning jobs to students. You may also have to reset some variables like Tally() which counts how many job are to be assigned.
    I don't know how and where to do it in your code though.
    Good luck

  14. #14
    Registered User
    Join Date
    12-11-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Need Help Assigning Jobs to Students

    I apologize for not reading closer. Thank you for all of your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1