Without knowing the actual count of each team, there is no way (that I can see) to give you a formula or macro solution... there are too many variable to account for given all the teams can have different number of players. With that said, I can give you a strategy to follow when assigning seats. First, the total number of tables needed (where that total is the minimum possible) would be the total number of players divided by 4 with only one table of 3 required if 4 does not divide the total number of players evenly. So, if N is the total number of players, the formula for the number of tables of 4 would be...

=INT(N/4)

and the number of tables of three players (either 0 or 1) would be....

=0+(MOD(A1/4,4)>0)

Now, as to the strategy for assigning teams (which player is immaterial... you can pick those randomly at the end)... take the team with the highest number of players and assign one to each table until you run out of players (if you have more players on a team than tables, then you will have to obviously double some tables up with players from the same team)... you can just randomly pick a table to assign each to (I am thinking some is walking around with the place cards an plopping them on a table). Then take the team with the next highest number of players and do the same thing... and then so on for the then next highest and so one. You would want to minimize loading table with say a third team while other tables had zero players assigned to them. The idea is to fill all tables with at least one team before putting a second team at any table. Similarly, fill each table with two teams before placing a third team on any single table and continue until you run out of team players. This should minimize the number of players from any one team at any single table (my guess is no table would ever have more than two players at the same table, and this would occur on the minimum number of tables).