Combinations VBA

Caribeiro77

Well-known Member
Joined
Sep 24, 2010
Messages
1,261
ABC
1
2TEAM 1TEAM 1TEAM 2
3TEAM 2TEAM 1TEAM 3
4TEAM 3TEAM 1TEAM 4
5TEAM 4TEAM 2TEAM 3
6TEAM 2TEAM 4
7TEAM 3TEAM 4
8

<tbody>
</tbody>

Hy all,

i have in column A, (starting in A2) the above:

I now need all the combinations of games ( just 1 round) E.G each team only plays one time with another team.

Output result in table above

Thanks in advance
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG23May19
[COLOR="Navy"]Dim[/COLOR] Ray [COLOR="Navy"]As[/COLOR] Variant, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] nn [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Ray = Range("A2:A5")
c = 1
[COLOR="Navy"]For[/COLOR] n = 1 To UBound(Ray, 1)
    [COLOR="Navy"]For[/COLOR] nn = n + 1 To UBound(Ray, 1)
        c = c + 1
        Cells(c, "B") = Ray(n, 1)
        Cells(c, "C") = Ray(nn, 1)
    [COLOR="Navy"]Next[/COLOR] nn
 [COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,260
Members
449,149
Latest member
mwdbActuary

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