Muneer Mikel wrote:

Does anybody know of a code that will assign table numbers (10 seats

per table) randomly for people attanding two events based on these

conditions:

1- All related persons in one family sit on the same table

2- People who sit on table (#65 for example) in event 1, shouldn't
sit on the same table in the event 2

3- Families from the same city shouldn't sit together

I don't even know of a way to approch this, not even something to
start from, and I don't know coding in VBA!

Thank you

I have two observations.

The first is that your conditions need more thought before they can be

implemented. For instance, what if eleven people are related? What if

three groups of greater than five related people have to sit at two

tables? Do you need to do optimization? What if the situation where

two families from the same city must sit together arises?

The second observation is that VBA coding will almost certainly be

required to solve these kinds of problems. The conditions you have are

similar to conditions I've run into with tournament and league

software. In a tournament you'd like to keep people from the same team

or league or state from meeting for as long as possible. Generating

the set of optimal solutions gets a little tricky. In a league with

x(j) pool tables available and y(j) teams for site j you want to create

league schedules that involve roughly the same number of home and away

matches. Since most leagues are handicapped thereby giving teams with

a stronger schedule early on an advantage it is also advantageous to

use power rankings to balance the schedule so that the strength of the

schedule does not vary much. For example, you could play the strongest

team one week and then the weakest team the next. Considerations such

as these are usually too much for an SQL-only solution. You'd also

want to determine if the conditions are so tight that no solution

exists. There may be other kinds of constraints also.

James A. Fortune