Huge Permutation Problem

LukeClosely

New Member
Joined
Aug 6, 2015
Messages
7
[COLOR=rgba(0, 0, 0, 0.701961)]Hello. Please could I have some advice to help solve a problem which has an extraordinary amount of permutations. I feel like I have got lost in the numbers somewhat and could be missing a relatively simple way to solve the problem.[/COLOR][COLOR=rgba(0, 0, 0, 0.701961)]
I have a simple sheet that records 100 bets and each bets potential winnings in ROW 2 to ROW 101.
Each bet involves 4 teams, one from each of 4 leagues (entitled League 1, League 2, League 3, League 4).
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]COL A = team from League 1[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]COL C = team from League 2[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]COL E = team from League 3[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]COL G = team from League 4[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]COL H = potential winnings for that individual bet.[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]For a bet to be successful ALL 4 TEAMS MUST WIN. If any of the 4 teams does not win the return from that bet is £0.[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]There will only be 3 winning teams from League 1,[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]3 winning teams from League 2,[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]3 winning teams from League 3,[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]4 winning teams from League 4.[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]This makes 13 winning teams in total.[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]However 12 different teams have been selected from League 1 (giving 12 unique values out of 100 entries),[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]16 selected from League 2,[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]15 selected from League 3,[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]17 selected from League 4.[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]
[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]My question is what combination of 13 teams would give me the maximum return?[/COLOR]
[COLOR=rgba(0, 0, 0, 0.701961)]Remember only 3 teams will win from Leagues 1,2+3 and 4 teams from League 4.

I am happy to answer any questions as without a photo I may not have explained clearly enough.

Thank You
[/COLOR]
 
The 5 teams with the largest values for each league (6 in league 4) can then be used.

The workbook I posted used 5,5,5 and 6 teams just as a simple example, which also allowed me to list the relatively few possible combinations (COMBIN(5,3)^3*COMBIN(6,4)=15,000) so that you could easily validate the VBA algorithm).

The code in Sub TestBets is dynamic, and in theory will accommodate as many bets and as many teams as you like to choose from. In practice, you can certainly go beyond 5 and 6, but not much further without generating too many possible combinations to test.

On my machine, checking 100 bets using 8 teams chosen from each league takes nearly two minutes. If you tried to test many more teams, the leagues would finish before the program!
 
  • Like
Reactions: shg
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

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