+ Reply to Thread
Results 1 to 8 of 8

Auto-filling Groups after selection of ranked choices

  1. #1
    Registered User
    Join Date
    11-13-2018
    Location
    Ripon
    MS-Off Ver
    365
    Posts
    4

    Auto-filling Groups after selection of ranked choices

    Hi,

    I have tried a few ways at achieving this but have not had any luck.

    I have attached some sample data. I am looking to see if excel can auto fill the group lists depending on the choices people have made.

    The data is collected through MSForms. I have added Row A as they are given an option for each day and a summary table on the right with the max allowed for each activity.

    Each person is given three choices on which activity they want to do. There is a maximum number of people in each activity. Priority is given to those who submit their choices first etc.

    Is there a way to automatically allocate everyone based on their choices?

    Thanks

    W
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    19,043

    Re: Auto-filling Groups after selection of ranked choices

    Hello WBYF and Welcome to Excel Forum.
    "Is there a way to automatically allocate everyone based on their choices?"
    I don't believe so because the sum of the max numbers is 56 and there are 65 people.
    In this instance would you allow only the first 56 persons who signed up to participate or would you take first choices until you reached the max number of each sport which would exclude some people who signed up on 5/7 with a first choice of football but include a person who signed up on 5/9 with a first choice of tennis?
    I also need to ask if you are only seeking VBA based solutions, or if a formula based solution (probably employing helper columns) is acceptable?
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    11-13-2018
    Location
    Ripon
    MS-Off Ver
    365
    Posts
    4

    Re: Auto-filling Groups after selection of ranked choices

    Hi JeteMc

    Thank you for for reply.

    It doesnt matter whether it is VBA or not - the key is that this can do the job which manually can take hours and hours - I am also keen to improve my knowledge of solving these sorts of problems.

    Ideally choice would always trump time of submission but in the case of filling it would fill in order of time. So i would fill 1st choices until the max has been reached.

    Sorry for the mismatch in the example in the real thing everyone should be doing something but it may not have been a choice of theirs.


    Thanks for your help!

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    19,043

    Re: Auto-filling Groups after selection of ranked choices

    This proposal employs four helper columns per day. Note that the helper columns may be hidden for aesthetic purposes.
    Note that the proposal employs sorting the date/time column from oldest to newest.
    The first helper column is populated using: =IF(COUNTIFS(C$3:C3,C3)>=INDEX(AA$4:AD$4,MATCH(C3,AA$3:AD$3,0)),"",C3)
    The second helper column is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The third helper column is populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The fourth helper column is populated using: =F3&G3&H3
    Note that the fourth column (I2:I67) is given the name Monday
    Note that these four columns will need to be repeated for each day.
    The table is then populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The formula that populates the table enables the names to be shown for the appropriate day (based on cell AA2) without needing a table per day.
    Note that I changed the Max numbers for demonstration purposes.
    Let us know if you have any questions.
    Attached Files Attached Files
    Last edited by JeteMc; 11-19-2018 at 04:52 PM.

  5. #5
    Registered User
    Join Date
    11-13-2018
    Location
    Ripon
    MS-Off Ver
    365
    Posts
    4

    Re: Auto-filling Groups after selection of ranked choices

    Hi,

    This is amazing, however I am coming across some problems when i try and edit the formulae.

    In reality there are 6 options and in fact this may again vary, I have tried to change the formula myself but some clumns seem to now max out not in the values entered in AA4:AF4.


    The changes I have made are as follows

    F3: =IF(COUNTIFS(C$3:C3,C3)>=INDEX(AA$4:AF$4,MATCH(C3,AA$3:AF$3,0)),"",C3)

    G3: =IF(F3<>"","",IF(SUM(COUNTIFS(F$3:F$138,D3),COUNTIFS(G$2:G2,D3))>=INDEX(AA$4:AF$4,MATCH(D3,AA$3:AF$3,0)),"",D3))

    H3: =IF(OR(F3<>"",G3<>""),"",IF(SUM(COUNTIFS(F$3:F$138,E3),COUNTIFS(G$2:G$138,E3),COUNTIFS(H$2:H2,E3))>=INDEX(AA$4:AF$4,MATCH(E3,AA$3:AF$3,0)),"",E3))

    I3: No change

    AA5: =IFERROR(INDEX($B$3:$B$138,AGGREGATE(15,6,(ROW($3:$138)-2)/(INDIRECT($AA$2)=AA$3),ROW(1:1))),"")

    New columns to incorporate events

    AE: =IFERROR(INDEX($B$3:$B$138,AGGREGATE(15,6,(ROW($3:$138)-2)/(INDIRECT($AA$2)=AE$3),ROW(1:1))),"")

    AF: =IFERROR(INDEX($B$3:$B$138,AGGREGATE(15,6,(ROW($3:$138)-2)/(INDIRECT($AA$2)=AF$3),ROW(1:1))),"")

    All dragged down to row 35.

    Thank you for your help

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    19,043

    Re: Auto-filling Groups after selection of ranked choices

    ...I have tried to change the formula myself but some clumns seem to now max out not in the values entered in AA4:AF4...
    Looking at the formulas I can't see any problems.
    Perhaps if you could upload a sample of the file that displays the issue we can come up with a solution.
    Let us know if you have any questions.

  7. #7
    Registered User
    Join Date
    11-13-2018
    Location
    Ripon
    MS-Off Ver
    365
    Posts
    4

    Re: Auto-filling Groups after selection of ranked choices

    Hi,

    Thank you for all your help with this. I have attached the file - I also notice that some are not being allocated an event despite there being space.

    Once again thank you for this

    Will
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    19,043

    Re: Auto-filling Groups after selection of ranked choices

    As for Excel's part in the issue, in the name manager > named range "Monday" > the 'Refers to:' was only referencing =Sheet1!$I$3:$I$67
    Change that to read: =Sheet1!$I$3:$I$500
    As for the part of the issue that isn't Excel's, the nine blanks in column I, the sum of the max participants in AA4:AF4 is 130. There are 136 people listed in column B so the max number of participants for at least some of the activities will need to be increased.
    Let us know if you have any questions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto-filling Textboxes based on selection in a combo box
    By aprilnparker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2018, 07:20 AM
  2. [SOLVED] Filling 2 seperate listboxes with different values based on combobox choices
    By bbqqsmokeman in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-26-2017, 02:34 PM
  3. [SOLVED] Auto-populating a table based on ranked values
    By BWellman in forum Excel General
    Replies: 4
    Last Post: 02-03-2014, 07:03 PM
  4. Separate into Ranked Groups by Overall Position-
    By mackensteff in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-11-2013, 09:31 AM
  5. Filling individual answers in their groups
    By zuwanda in forum Excel General
    Replies: 3
    Last Post: 02-08-2012, 11:56 PM
  6. Auto filling cells based on drop down menu selection
    By Candace84 in forum Excel General
    Replies: 1
    Last Post: 11-19-2010, 02:59 AM
  7. Choices made available dependent on another selection?
    By Miss Spaghetti in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-20-2005, 09:06 PM

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