+ Reply to Thread
Results 1 to 14 of 14

Seating Plan

Hybrid View

  1. #1
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Seating Plan

    Hey,

    I'm working on a seating plan for our christmas party this year.

    Complete randomization of a list I can do, but I need conditions. We have 67 people, and 7 departments. I need seats 1-7 to be filled by 1 person from each department, then seats 8-14 to be the same and so on.

    Ideally, adjacent seats would be boy-girl-boy-girl etc.

    Each department has a different amount of people. There are 3 tables.

    Sample attached. I don't expect to have it all done for me, so any pointers/guidance would be good enough. I've used INDEX with MATCH before but I can't quite work it of for this job.

    EDIT: I've posted this elsewhere too: http://www.mrexcel.com/forum/excel-q...ml#post4678259

    Thanks!
    Attached Files Attached Files
    Last edited by ldoodle; 11-09-2016 at 10:02 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,811

    Re: Seating Plan

    Welcome to the forum!

    Unfortunately, your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please do not ignore this request: providing those links is not optional. Thanks!

    EDIT: link now added - thank you.
    Last edited by AliGW; 11-09-2016 at 12:25 PM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Re: Seating Plan

    Sorry about that.

    I think I'm getting somewhere, using this formula:

    =INDEX($A$2:$A$100,LARGE(IF($B$2:$B$100=$K2,ROW($B$2:$B$100)-ROW($B$2)+1),INT(RAND()*COUNTIF($B$2:$B$100,$K2)+1)))
    The only issue is that duplicates are selected. Can I get it to ignore a match if it's already been matched?

    Thanks.

  4. #4
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Re: Seating Plan

    What about this:

    Column A contains a list of attendees
    Column B contains the department they're
    Column C contains =RAND()

    Column G: =INDEX($A$2:$A$100,SMALL(IF($B$2:$B$100=H2,ROW($A$2:$A$100)-ROW($A$2)+1),COUNTIF(H$2:H2,H2)))
    Column H: =INDEX($B$2:$B$100,RANK(C2,$C$2:$C$100))

    So the index lookup in Column H is referencing Column B, which uses column G to match on the department to Column B. Column G is random based on the RANK of the values in Column C which is a random number.

    This is working well. However, is it possible to get RANK to not repeat the same number in sequential rows? At the moment, this can happen:

    1
    1
    2
    3
    4
    5
    6
    6
    4
    4
    3
    3
    2
    1
    2
    4
    4
    5
    5
    5
    5

    I'd like not have that. For example if the row above is a 1, it has to be any other number. Ideally it would skip a few rows before allowing the same number.

    !!

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,885

    Re: Seating Plan

    This is a very difficult task since there are so different amount of people in each department and not equal amount of ladies and gents.
    Department no 7 is all women and rather large. Department no 4 is only 5 people.
    The best I can think of is to make an acceptable Male/Female placement manually, number the male and female seats, and then use a randomgenerator to place the names.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,811

    Re: Seating Plan

    I have to be completely honest here: it would be quicker and easier to do this task the old-fashioned way than try to find an automated solution.

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Seating Plan

    Hi
    I agree with @AliGW. I tried to optimize with help tables and now I show you what I did.

    Algorithm:

    1) Determine the number of people in each department on each table by gender (columns K, L, M) and the rest (O, P, Q)

    2) Sort the departments by table and determine the frequencies to be distributed by different areas of each table (Tables from S2:AF9)

    3) Determine upper and lower limits for each department to use in position of the person in the table (Table AH2:AO9)

    4) Tables to distribute persons in each table (AQ2:BJ21)

    5) Characterize the elements of each table (BL2:BV21)

    6) List of person not in tables

    7) Output on sheets Table_One, Table Two and Table_Three

    8) manualy distributed the rest of attendees.


    Notes:You can sort by columns D - Sort the attendees, T, Y, AD - Departments on table 1, 2 , 3, AV, BC, BJ - Resort persons in table 1, 2, and 3.
    After order by each of that columns the values are updated and the column shows a random order.


    See the file
    Attached Files Attached Files

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,729

    Re: Seating Plan

    Look at this link for a tutorial and template

    http://blog.contextures.com/archives...ng-with-excel/
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  9. #9
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Re: Seating Plan

    Thanks all. I think you're right that it's a step too far to fully automate it as required.

    So to simplify it, I'm dropping the boy-girl-boy-girl requirement. Then, is it possible to combine randomness with some orderliness? By that I mean:

    A.......B
    -----------
    1.......10
    2.......6
    3.......4
    4.......14
    5.......9
    6.......7
    7.......5

    So column A is all the departments and Column B is the user count in each department. Can I do anything that will randomly populate rows in a specified column with a department number but only total the users count, and not put the same department number on following rows (except department 4 as they'll need to be together in 2 or 3's probably). To end up with 10X 1, 6X 2, 4X 3, 14X 4 etc.

    I'm doing this at the moment, but there's no maximum for each number: =IF(ISBLANK($A12),"",RANDBETWEEN(1,7))

    Thanks!
    Last edited by ldoodle; 11-12-2016 at 02:38 PM.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Seating Plan

    I'd approach this as a hill-climbing exercise with the objective of maximizing entropy.

    Say you have three round tables of, say 20 people each. That's 20 adjacent pairs at each table, 60 adjacent pairs total. Each adjacent pair is defined to have entropy based on their gender and department, as follows:

    Gender
    Dept
    Entropy
    Same Same
    0
    Same Diff
    1
    Diff Same
    2
    Diff Diff
    3

    You could redefine that as you choose, depending on whether you regard gender or department as the more significant (or the same) in a pairing.

    Start with a random assignment, and calculate the sum of the entropy for the entire seating.

    Then, in a loop, try making every possible swap (that's 60 * 59 possibilities), and recalculate the entropy. If it increases, do the swap; if not, don't.

    Repeat the loop until no swap increases the entropy.

    It would require VBA, and I'm not volunteering, but hill-climbing is a well-established algorithm.
    Last edited by shg; 11-13-2016 at 03:01 PM.
    Entia non sunt multiplicanda sine necessitate

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Seating Plan

    A variation of that algorithm that keeps you from getting stuck in a local maximum is called annealing. In that case, you sometimes (probabilistically) accept a swap that makes the entropy lower, with the probability going down as the algorithm proceeds.
    Last edited by shg; 11-12-2016 at 07:03 PM.

  12. #12
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,885

    Re: Seating Plan

    Here's an idea I had but it's not complete:
    Assume that we are just dealing with males.
    Line up the seats in one long row. Take the department with most people in and distribute them evenly over the long row of seats. That will maximize the distance between the group that need it the most.
    Next take the department with the second most people in. Distribute them evenly between only the seats that are for instance to the left of the first group.
    Next take the department with the third most people in. Distribute them evenly to the left of the ones from the first department that still has no neighbor and then distribute the rest to the left of the second department.
    And so on.

    Like I mentioned, I have no idea how to extend this idea into using both sexes.
    I don't have the energi or the brains to take this much further, I'm hoping for someone else to pick up the ball.

  13. #13
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Re: Seating Plan

    Hi,

    I am so close now. I've switched to doing the bulk of the work in VBA. This is working well.

    The only think I can't get right is RANK. Columns L and M are populated from VBA. Cells in column H then use INDEX with RANK to fill themselves from M, based on the rank in L

    As I am doing this in VBA, if dept = 1:

    Rand = WorksheetFunction.Choose(WorksheetFunction.RandBetween(1, count), 5, 10, 15, 20, 25, 35, 40, 45, 50, 55, 60)
    I would expect every 5th cell in column H to be one of these numbers?

    Well that's how I'm expecting RANK to work? Is that wrong?
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    11-09-2016
    Location
    London, England
    MS-Off Ver
    2010/2016
    Posts
    74

    Re: Seating Plan

    Got it:

    =IF($M12="","",INDEX($M$12:$M$500,MATCH(ROWS($L$12:$L12),$L$12:$L$500,0)))

    Thanks for all the help provided.

+ 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. [SOLVED] Table Seating Plan for Wedding
    By philde in forum Excel General
    Replies: 9
    Last Post: 03-30-2015, 03:09 AM
  2. [SOLVED] Automatic Seating Plan
    By sallynz in forum Excel General
    Replies: 3
    Last Post: 09-18-2014, 09:20 AM
  3. Excel seating plan help
    By alanaldrige in forum Excel General
    Replies: 1
    Last Post: 09-08-2014, 05:24 PM
  4. Seating Plan Lookup
    By Jay_hl in forum Excel General
    Replies: 2
    Last Post: 06-25-2014, 09:03 AM
  5. Seating Plan Generation
    By Jay_hl in forum Excel General
    Replies: 3
    Last Post: 06-17-2014, 04:42 PM
  6. Seating Plan
    By 9krk2 in forum Excel General
    Replies: 7
    Last Post: 06-07-2013, 03:00 PM
  7. design a seating plan
    By yavir in forum Excel General
    Replies: 1
    Last Post: 04-24-2006, 01:22 AM

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