PDA

View Full Version : [SOLVED:] Fixture List



JohnL
05-02-2023, 03:35 AM
I'm trying to create a small league. The league would have between 6 and 20 teams. I've been trying to create a function that would create fixtures whereby teams would play all others once only in different Rounds. I've created the 1st round with a Do Until loop but after that I'm having problems. Has anybody else done this or have any idea how to create the function?

1 v 2
3 v 4
5 v 6
7 v 8

1 v 3
2 v 5
4 v 7
6 v 8

etc

arnelgp
05-02-2023, 04:20 AM
google combination/permutation code.

Mackiei
05-17-2023, 11:54 PM
I am not clear much when using google combination/permutation code.

Aussiebear
05-18-2023, 05:19 AM
Okay to create a list all combinations of "fixture" matches, place a list of all teams( as I don't know your teams, I used a to k) in column A. Copy the filled range and paste into Column B. Then in cell C1 enter the following formula

=IF(ROW()-ROW($C$1(+1>COUNTA(A:A)*COUNTA(B:B)," ",INDEX(A:A,INT((Row()-ROW($C$1))/COUNTA(B:B)+1)) & "," & INDEX(B:B,MOD(ROW()-ROW($C$1),COUNTA(B:B))=1))

Copy down until no more data is filled. In my test workbook I used 11 teams (a to k), and this filled down to cell C121. Data in Column C will show as a,a a,b a,c etc. Common sense will tell you there are two rules to be applied here, and these are a team cannot play against itself in a Fixture match, and secondly a team cannot play against a team for which it has already played. So we need to find a method/s to remove the incorrect data.

I'm not confident that this code as supplied is correct, and I'm hoping that someone will provide the correct solution.



Sub CheckTeams()
Dim i as Long
Dim lRow as Long
With Sheets("Sheet1")
For i = lRow to 1 step -1
If .cells(I,"C").Value = StrReverse(i,"C").value Then
.Cells(i).Delete
End If
Next I
End With
With Sheets("Sheet1")
For each cell in Range("C1:C & lRow")
If(Left(C& i,1)=Right(C & i,1) Then
.Cells(i).Delete
End If
Next I
End With
End Sub


What I was hoping here in the first part, was to be able to start with the last value in Column C and compare against the string reversed of every other cell and if found then delete the cell you are looking up. And in the second part I am trying to remove a match where a team plays against itself.

As I said earlier, untested and I'm not a coder. For the Code guru's, when you've finished laughing, can you please supply the solution?

georgiboy
05-18-2023, 06:24 AM
As @arnelgp pointed out earlier, GIYBF for this:
https://www.get-digital-help.com/round-robin-tournament/

Mackiei
05-18-2023, 06:09 PM
Thank you