Very challenging function/sub. Help needed.

kbiz

New Member
Joined
May 25, 2010
Messages
4
Not sure if its best to do this with a function or a sub, but this is extremely hard to figure out how to do this. The funny thing is that this task is very easy for any person to do manually, I just want Excel to do it automatically.

Its a bracket tournament, with seeds just like the NCAA basketball tournament, except the brackets can be smaller, e.g. 4, 8, 16, 32 (or more simply, 2^x size) team brackets.

Here is the easy part:
Teams are given their seed on a spreadsheet and then normally the teams would be put on a certain position on the bracket based on their seed. So for example a four team bracket would have their positions on the bracket like this:

Position 1: Seed 1
Position 2: Seed 4
Position 3: Seed 3
Position 4: Seed 2

an eight team tournament would look like this:

Position 1: Seed 1
Position 2: Seed 8
Position 3: Seed 5
Position 4: Seed 4
Position 5: Seed 3
Position 6: Seed 6
Position 7: Seed 7
Position 8: Seed 2

a sixteen team tournament would look like this:

Position 1: Seed 1
Position 2: Seed 16
Position 3: Seed 9
Position 4: Seed 8
Position 5: Seed 5
Position 6: Seed 12
Position 7: Seed 13
Position 8: Seed 4
Position 9: Seed 3
Position 10: Seed 14
Position 11: Seed 11
Position 12: Seed 6
Position 13: Seed 7
Position 14: Seed 10
Position 15: Seed 15
Position 16: Seed 2

and so on...

HERE is the extremely difficult part:
I want to write a function or a sub that would place teams in their correct position based on their seed EXCEPT when it puts two teams from the same conference in the same section of the bracket (their conference name is in a column next to the team name). This may seem straight forward but its not because a bracket can have any number of conferences with any number of teams from the same conference. Not only that but a tournament bracket can be any size, adding to the complications. Like I said, doing this visually on paper is very simple but trying to explain this to a computer is extremely challenging.

Some detail:

If a conference has two teams participating, both teams must be on opposite halves of the bracket. If it has 3 or 4 teams, each team must be in its own quadrant of the bracket. If it has 5-8 teams, each team must occupy its own 'eighth' of the bracket. And so on (keeping as close to their original seed as possible).

The number 1 seed gets the #1 position no matter what.

Teams from the same conference cannot change their rankings among themselves. For example, supposed Team A and Team B are in the same conference. If Team A was supposed to be a 3 seed a Team B was supposed to be a 4 seed, the code can't ever put Team B in a position that represents a higher seed than Team A.

So basically, I would love to have a sub that would be able to take any size bracket and place all the teams so that their seeding is very close to what its supposed to be, but more importantly the teams are perfectly separated by conference on the bracket. OR should it be a function that assigns a position based on an algorithm that looks at their proposed seed and their position based on their conference participants?

Anyone with the brainpower to figure this out - well, you'll have my ultimate appreciation. Thanks for any help that you guys can give me.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,214,588
Messages
6,120,412
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top