Generate a game schedule for 5 teams

xuamox

New Member
Joined
Nov 6, 2015
Messages
1
Hi,

I would like to know if I can use excel to generate a game schedule for 5 teams, where each team has to play each other once?
I know that 5 teams is easy to figure out on paper, but I wanted to know how you would go about it using excel.

1 vs 2
1 vs 3
1 vs 4
1 vs 5
2 vs 3
2 vs 4
2 vs 5
3 vs 4
3 vs 5
4 vs 5

Thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Welcome to the Board!

Here is one macro that will do that:
Code:
Sub Schedule()

    Dim numTeams As Long
    Dim first As Long
    Dim second As Long
    Dim startCell As Range
    Dim counter As Long
    
    Application.ScreenUpdating = False
    
'   Designate the number of teams
    numTeams = 5
    
'   Select starting cell
    Set startCell = Range("A1")
    
    counter = 0
'   Loop through list
    For first = 1 To (numTeams - 1)
        For second = (first + 1) To numTeams
            startCell.Offset(counter, 0) = first & " vs " & second
            counter = counter + 1
        Next second
    Next first
                
    Application.ScreenUpdating = True
                
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,495
Messages
6,130,979
Members
449,611
Latest member
Bushra

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