Combinations VBA

Caribeiro77

Well-known Member
Joined
Sep 24, 2010
Messages
1,261
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]TEAM 1[/TD]
[TD]TEAM 1[/TD]
[TD]TEAM 2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]TEAM 2[/TD]
[TD]TEAM 1[/TD]
[TD]TEAM 3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]TEAM 3[/TD]
[TD]TEAM 1[/TD]
[TD]TEAM 4[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]TEAM 4[/TD]
[TD]TEAM 2[/TD]
[TD]TEAM 3[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]TEAM 2[/TD]
[TD]TEAM 4[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD]TEAM 3[/TD]
[TD]TEAM 4[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,224,830
Messages
6,181,227
Members
453,025
Latest member
Hannah_Pham93

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