Golf League Scheduling

cdh121

New Member
Joined
Jul 21, 2005
Messages
31
Hi everyone:

I have looked through the message boards for solutions to my problem and I don't think I've found anything that quite fits. Here's my challenge...

I run a golf league with 32 teams, so I have 16 tee time slots. Because of time constraints, job responsibilities, etc., my teams fall into 3 general groups:
  • Those that can play in any of the tee time slots (1-16)
  • Those that can only play in slots 1-8
  • Those that can only play in slots 9-16
I am also trying to avoid teams playing each other in back-to-back weeks if possible, but repeats over the course of the season are OK, as are teams not playing each other at all (our season typically runs 16 weeks).

Any help or solutions to this issue are most welcome. If there is an existing solution on these boards that you're aware of, please point me in that direction as well. Thanks in advance.
 
Actually I was thinking the other sheets aren't necessary. If you think this work ok I will modify it so everything is on the same sheet and in one formula.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Here is the unified (and corrected) formula:

File to download: GolfLeagueScheduling3.1.zip

GolfLeagueScheduling3.1.xlsx
ABCDEFGHIJKLMNOPQRSTU
1GroupSize
2A12Slots12345678910111213141516
3B8Weeks1B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11
4C122A7 - A10B6 - A8B8 - A9B5 - A6B1 - B3A11 - A1B7 - A3B4 - B2C5 - A4C7 - A2C8 - A5C10 - C11C9 - C12C6 - A12C1 - C3C4 - C2
5323B5 - B3B1 - B4A1 - A4B6 - B2A9 - A10B8 - A8A11 - A7B7 - A12C8 - A6C6 - C2C9 - A2C10 - A5C5 - C3C11 - C12C7 - A3C1 - C4
64A6 - A4A1 - A5B7 - B3B1 - B5A10 - A11A7 - A3B8 - B2B6 - B4C11 - A9C9 - A12C7 - C3C1 - C5C12 - A8C8 - C2C6 - C4C10 - A2
7Weeks165B1 - B6A9 - B2B7 - B5A3 - B3A8 - A4A7 - A5A10 - A2B8 - B4C9 - C3C8 - C4C7 - C5C11 - A1C12 - A6C1 - C6C10 - C2A11 - A12
86A1 - B5A7 - B4A9 - B3B1 - B7A5 - B2A12 - A2A8 - A6B8 - B6A10 - A4C9 - C5C8 - C6C10 - C4A11 - A3C11 - C3C12 - C2C1 - C7
9Seed16/01/20247A9 - A7A10 - B5A6 - B7B1 - B8A11 - B6A5 - B4A12 - B3A4 - B2A2 - C3C10 - C6C11 - C5A3 - A1C12 - C4C9 - C7C1 - C8A8 - C2
108A1 - B5A9 - B7A3 - B2A4 - B6A2 - B4A5 - B3B1 - A12A6 - B8C12 - C6A10 - C5C1 - C9C11 - C7A8 - C2C10 - C8A11 - C3A7 - C4
119A3 - B6A6 - B5B1 - A2A7 - B7A11 - B8B2 - B3A9 - A12A8 - B4A4 - C6C1 - C10C2 - C3A5 - C5A1 - C4C11 - C9A10 - C7C12 - C8
1210A3 - B6A8 - B8B1 - A12A10 - A4B3 - B4A7 - B7A2 - A9B2 - B5C1 - C11C3 - C4C2 - C5A5 - C6A6 - C7C12 - C10A1 - C9A11 - C8
1311B3 - B6A1 - A12A3 - A10B4 - B5B2 - B7B1 - A2A11 - A6A7 - B8C1 - C12A5 - C10C3 - C6A8 - C8C2 - C7A4 - C11A9 - C9C4 - C5
1412B5 - B6A1 - A2B1 - A6B4 - B7B3 - B8A9 - A7B2 - A8A4 - A11C5 - C6C3 - C8A3 - C11C2 - C9A12 - C10C1 - A5C4 - C7A10 - C12
1513B2 - A7B3 - A10B1 - A8B6 - B7A9 - A6B5 - B8A11 - A1B4 - A3C3 - C10C1 - A4C5 - C8A2 - C12A5 - A12C4 - C9C2 - C11C6 - C7
1614A1 - A4B5 - A9B7 - B8B2 - A10B4 - A8B1 - A11B6 - A7B3 - A12A6 - A2C2 - A5C6 - C9C1 - A3C3 - C12C4 - C11C7 - C8C5 - C10
1715B3 - A6B6 - A4B8 - A1B5 - A5B4 - A10B7 - A11B2 - A7B1 - A3C5 - C12C6 - C11C8 - C9C4 - A9C2 - A12C3 - A8C7 - C10C1 - A2
1816B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11
Total
Cell Formulas
RangeFormula
F2:U2F2=SEQUENCE(,SUM(B2:B4)/2)
E3:E18E3=SEQUENCE(B7)
F3:U18F3=LET( GAB, LET(n,16, seed, $B$9+100, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GAC, LET(n,16, seed, $B$9, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GA, LET(n,$B$2, seed, $B$9+50, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GABt, BYROW(GAB, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")),TEXTJOIN(" - ",, IF(arr>$B$3, "A1."&TEXT(arr,"00"),"B"&arr))))), GACt, BYROW(GAC, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")), TEXTJOIN(" - ",, IF(arr>$B$4, "A2."&TEXT(arr,"00"),"C"&arr))))), ABC, HSTACK(GABt,GACt), tj, TEXTJOIN(" - ", ,BYROW(ABC, LAMBDA(x, TEXTJOIN(" - ",,x)))), t, TEXTSPLIT(tj, " - "), a, SORT(UNIQUE(FILTER(t, LEFT(t,1)="A"),1), ,,1), s, "A"&SEQUENCE(,COLUMNS(a)), r, IFERROR(XLOOKUP(t, a, s, ,0),t), index, DROP(REDUCE(0, r, LAMBDA(acuArr,newItem, HSTACK(acuArr, TAKE(acuArr,1,-1)+IF(LEFT(newItem,1)="A", 1, 0)))), ,1), v, VALUE(TEXTSPLIT(TEXTJOIN(" - ", ,GA)," - ")), Aarr, HSTACK(v,v), i, IF(LEFT(r,1)="A", "A"&INDEX(Aarr,1, index), r), res, WRAPROWS(BYROW(WRAPROWS(i, 2), LAMBDA(x, TEXTJOIN(" - ",,x))), 16), ress,TAKE(VSTACK(res,res), $B$7), ress )
B5B5=SUM(B2:B4)
Dynamic array formulas.
 
Upvote 0
Felix, this is totally awesome and right on the money. A couple of final questions:
  1. I assume it's possible to rename my weeks to dates and rename my slots to times if desired...correct?
  2. Is it possible to add a sheet to identify my teams by name along with the identifier they get in your schedule sheet?
 
Upvote 0
Hi, thanks for the feedback.
Yes you can change the week number and the slots number to anything you like.
I added a table with team IDs and team Names and a "schedule" sheet.

File to download: GolfLeagueScheduling3.2.zip

GolfLeagueScheduling3.2.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1GroupSizeTime
2A1208:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:00Team IDTeam Name
3B815/07/2024B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11A1Name A1
4C1216/07/2024A7 - A10B6 - A8B8 - A9B5 - A6B1 - B3A11 - A1B7 - A3B4 - B2C5 - A4C7 - A2C8 - A5C10 - C11C9 - C12C6 - A12C1 - C3C4 - C2A2Name A2
53217/07/2024B5 - B3B1 - B4A1 - A4B6 - B2A9 - A10B8 - A8A11 - A7B7 - A12C8 - A6C6 - C2C9 - A2C10 - A5C5 - C3C11 - C12C7 - A3C1 - C4A3Name A3
618/07/2024A6 - A4A1 - A5B7 - B3B1 - B5A10 - A11A7 - A3B8 - B2B6 - B4C11 - A9C9 - A12C7 - C3C1 - C5C12 - A8C8 - C2C6 - C4C10 - A2A4Name A4
7Weeks1619/07/2024B1 - B6A9 - B2B7 - B5A3 - B3A8 - A4A7 - A5A10 - A2B8 - B4C9 - C3C8 - C4C7 - C5C11 - A1C12 - A6C1 - C6C10 - C2A11 - A12A5Name A5
822/07/2024A1 - B5A7 - B4A9 - B3B1 - B7A5 - B2A12 - A2A8 - A6B8 - B6A10 - A4C9 - C5C8 - C6C10 - C4A11 - A3C11 - C3C12 - C2C1 - C7A6Name A6
9Seed16/01/202423/07/2024A9 - A7A10 - B5A6 - B7B1 - B8A11 - B6A5 - B4A12 - B3A4 - B2A2 - C3C10 - C6C11 - C5A3 - A1C12 - C4C9 - C7C1 - C8A8 - C2A7Name A7
1024/07/2024A1 - B5A9 - B7A3 - B2A4 - B6A2 - B4A5 - B3B1 - A12A6 - B8C12 - C6A10 - C5C1 - C9C11 - C7A8 - C2C10 - C8A11 - C3A7 - C4A8Name A8
1125/07/2024A3 - B6A6 - B5B1 - A2A7 - B7A11 - B8B2 - B3A9 - A12A8 - B4A4 - C6C1 - C10C2 - C3A5 - C5A1 - C4C11 - C9A10 - C7C12 - C8A9Name A9
1226/07/2024A3 - B6A8 - B8B1 - A12A10 - A4B3 - B4A7 - B7A2 - A9B2 - B5C1 - C11C3 - C4C2 - C5A5 - C6A6 - C7C12 - C10A1 - C9A11 - C8A10Name A10
1329/07/2024B3 - B6A1 - A12A3 - A10B4 - B5B2 - B7B1 - A2A11 - A6A7 - B8C1 - C12A5 - C10C3 - C6A8 - C8C2 - C7A4 - C11A9 - C9C4 - C5A11Name A11
1430/07/2024B5 - B6A1 - A2B1 - A6B4 - B7B3 - B8A9 - A7B2 - A8A4 - A11C5 - C6C3 - C8A3 - C11C2 - C9A12 - C10C1 - A5C4 - C7A10 - C12A12Name A12
1531/07/2024B2 - A7B3 - A10B1 - A8B6 - B7A9 - A6B5 - B8A11 - A1B4 - A3C3 - C10C1 - A4C5 - C8A2 - C12A5 - A12C4 - C9C2 - C11C6 - C7A13Name A13
1601/08/2024A1 - A4B5 - A9B7 - B8B2 - A10B4 - A8B1 - A11B6 - A7B3 - A12A6 - A2C2 - A5C6 - C9C1 - A3C3 - C12C4 - C11C7 - C8C5 - C10A14Name A14
1702/08/2024B3 - A6B6 - A4B8 - A1B5 - A5B4 - A10B7 - A11B2 - A7B1 - A3C5 - C12C6 - C11C8 - C9C4 - A9C2 - A12C3 - A8C7 - C10C1 - A2B1Name B1
1805/08/2024B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11B2Name B2
19B3Name B3
20B4Name B4
21B5Name B5
22B6Name B6
23B7Name B7
24B8Name B8
25B9Name B9
26B10Name B10
27B11Name B11
28B12Name B12
29B13Name B13
30B14Name B14
31C1Name C1
32C2Name C2
33C3Name C3
34C4Name C4
35C5Name C5
36C6Name C6
37C7Name C7
38C8Name C8
39C9Name C9
40C10Name C10
41C11Name C11
42C12Name C12
43C13Name C13
44C14Name C14
Teams + Calculation
Cell Formulas
RangeFormula
E3:T18E3=LET( tn, $B$5, GAB, LET(n,tn/2, seed, $B$9+100, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GAC, LET(n,tn/2, seed, $B$9, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GA, LET(n,$B$2, seed, $B$9+50, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final), GABt, BYROW(GAB, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")),TEXTJOIN(" - ",, IF(arr>$B$3, "A1."&TEXT(arr,"00"),"B"&arr))))), GACt, BYROW(GAC, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")), TEXTJOIN(" - ",, IF(arr>$B$4, "A2."&TEXT(arr,"00"),"C"&arr))))), ABC, HSTACK(GABt,GACt), tj, TEXTJOIN(" - ", ,BYROW(ABC, LAMBDA(x, TEXTJOIN(" - ",,x)))), t, TEXTSPLIT(tj, " - "), a, SORT(UNIQUE(FILTER(t, LEFT(t,1)="A"),1), ,,1), s, "A"&SEQUENCE(,COLUMNS(a)), r, IFERROR(XLOOKUP(t, a, s, ,0),t), index, DROP(REDUCE(0, r, LAMBDA(acuArr,newItem, HSTACK(acuArr, TAKE(acuArr,1,-1)+IF(LEFT(newItem,1)="A", 1, 0)))), ,1), v, VALUE(TEXTSPLIT(TEXTJOIN(" - ", ,GA)," - ")), Aarr, HSTACK(v, v, v, v, v, v, v, v), i, IF(LEFT(r,1)="A", "A"&INDEX(Aarr,1, index), r), res, WRAPROWS(BYROW(WRAPROWS(i, 2), LAMBDA(x, TEXTJOIN(" - ",,x))), 16), ress,TAKE(VSTACK(res,res), $B$7), ress )
B4B4=32-B2-B3
B5B5=SUM(B2:B4)
D4:D18D4=WORKDAY(D3,1)
Dynamic array formulas.



Here the schedule ( i didnt include all the rows because of the size)
Cell Formulas
RangeFormula
B1:Q1,A2:A3B1='Teams + Calculation'!E2
B2:Q3B2=TEXTJOIN(CHAR(10), ,XLOOKUP(TEXTSPLIT('Teams + Calculation'!E3, " - "), Teams[[Team ID]:[Team ID]], Teams[[Team Name]:[Team Name]], "not in team list",0))
 
Upvote 1
Solution
Here is a cleaner version of the formula (i used lambda function instead of repeating 3 times the same code):

GolfLeagueScheduling3.3.xlsx
ABCDEFGHIJKLMNOPQRST
1GroupSizeTime
2A1208:0009:0010:0011:0012:0013:0014:0015:0016:0017:0018:0019:0020:0021:0022:0023:00
3B815/07/2024B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11
4C1216/07/2024A7 - A10B6 - A8B8 - A9B5 - A6B1 - B3A11 - A1B7 - A3B4 - B2C5 - A4C7 - A2C8 - A5C10 - C11C9 - C12C6 - A12C1 - C3C4 - C2
53217/07/2024B5 - B3B1 - B4A1 - A4B6 - B2A9 - A10B8 - A8A11 - A7B7 - A12C8 - A6C6 - C2C9 - A2C10 - A5C5 - C3C11 - C12C7 - A3C1 - C4
618/07/2024A6 - A4A1 - A5B7 - B3B1 - B5A10 - A11A7 - A3B8 - B2B6 - B4C11 - A9C9 - A12C7 - C3C1 - C5C12 - A8C8 - C2C6 - C4C10 - A2
7Weeks1619/07/2024B1 - B6A9 - B2B7 - B5A3 - B3A8 - A4A7 - A5A10 - A2B8 - B4C9 - C3C8 - C4C7 - C5C11 - A1C12 - A6C1 - C6C10 - C2A11 - A12
822/07/2024A1 - B5A7 - B4A9 - B3B1 - B7A5 - B2A12 - A2A8 - A6B8 - B6A10 - A4C9 - C5C8 - C6C10 - C4A11 - A3C11 - C3C12 - C2C1 - C7
9Seed16/01/202423/07/2024A9 - A7A10 - B5A6 - B7B1 - B8A11 - B6A5 - B4A12 - B3A4 - B2A2 - C3C10 - C6C11 - C5A3 - A1C12 - C4C9 - C7C1 - C8A8 - C2
1024/07/2024A1 - B5A9 - B7A3 - B2A4 - B6A2 - B4A5 - B3B1 - A12A6 - B8C12 - C6A10 - C5C1 - C9C11 - C7A8 - C2C10 - C8A11 - C3A7 - C4
1125/07/2024A3 - B6A6 - B5B1 - A2A7 - B7A11 - B8B2 - B3A9 - A12A8 - B4A4 - C6C1 - C10C2 - C3A5 - C5A1 - C4C11 - C9A10 - C7C12 - C8
1226/07/2024A3 - B6A8 - B8B1 - A12A10 - A4B3 - B4A7 - B7A2 - A9B2 - B5C1 - C11C3 - C4C2 - C5A5 - C6A6 - C7C12 - C10A1 - C9A11 - C8
1329/07/2024B3 - B6A1 - A12A3 - A10B4 - B5B2 - B7B1 - A2A11 - A6A7 - B8C1 - C12A5 - C10C3 - C6A8 - C8C2 - C7A4 - C11A9 - C9C4 - C5
1430/07/2024B5 - B6A1 - A2B1 - A6B4 - B7B3 - B8A9 - A7B2 - A8A4 - A11C5 - C6C3 - C8A3 - C11C2 - C9A12 - C10C1 - A5C4 - C7A10 - C12
1531/07/2024B2 - A7B3 - A10B1 - A8B6 - B7A9 - A6B5 - B8A11 - A1B4 - A3C3 - C10C1 - A4C5 - C8A2 - C12A5 - A12C4 - C9C2 - C11C6 - C7
1601/08/2024A1 - A4B5 - A9B7 - B8B2 - A10B4 - A8B1 - A11B6 - A7B3 - A12A6 - A2C2 - A5C6 - C9C1 - A3C3 - C12C4 - C11C7 - C8C5 - C10
1702/08/2024B3 - A6B6 - A4B8 - A1B5 - A5B4 - A10B7 - A11B2 - A7B1 - A3C5 - C12C6 - C11C8 - C9C4 - A9C2 - A12C3 - A8C7 - C10C1 - A2
1805/08/2024B7 - A1B6 - A2B1 - B2B3 - A6A9 - A7B4 - A8B5 - A4B8 - A11C5 - A3C1 - C2C4 - A12C9 - C10C3 - A5C7 - C12C6 - A10C8 - C11
Teams + Calculation
Cell Formulas
RangeFormula
E3:T18E3=LET( comb, LAMBDA(nt,seed, LET(n,nt, i,SEQUENCE(n-1,,0), k,INT((SEQUENCE(,n-2)+1)/2), s,IF(ISODD(SEQUENCE(,n-2)),1,-1), res,HSTACK(EXPAND(1,n-1,,1),i+2,MOD(i+k*s,n-1)+2), rows,WRAPROWS(TOCOL(res),2), pairs,BYROW(rows,LAMBDA(x,CHOOSECOLS(x,1)&" - "&CHOOSECOLS(x,2))), nPairs,(n-1)*(n/2), randomNumbers,DROP(REDUCE(seed*(2^31-1)/73051,SEQUENCE(nPairs),LAMBDA(x,y,VSTACK(x,MOD(48271*CHOOSEROWS(x,-1),2^31-1)))),1)/(2^31-1), randomOrder,INT(SEQUENCE(nPairs,,0)/(n/2))+1+randomNumbers, orderedPairs,SORTBY(pairs,randomOrder), final,WRAPROWS(orderedPairs,n/2), final) ), tn, $B$5, seed, $B$9, GAB, comb(tn/2, seed+100), GAC, comb(tn/2, seed), GA, comb($B$2, seed+50), GABt, BYROW(GAB, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")),TEXTJOIN(" - ",, IF(arr>$B$3, "A1."&TEXT(arr,"00"),"B"&arr))))), GACt, BYROW(GAC, LAMBDA(x, LET(arr, VALUE(TEXTSPLIT(TEXTJOIN(" - ",,x)," - ")), TEXTJOIN(" - ",, IF(arr>$B$4, "A2."&TEXT(arr,"00"),"C"&arr))))), ABC, HSTACK(GABt,GACt), tj, TEXTJOIN(" - ", ,BYROW(ABC, LAMBDA(x, TEXTJOIN(" - ",,x)))), t, TEXTSPLIT(tj, " - "), a, SORT(UNIQUE(FILTER(t, LEFT(t,1)="A"),1), ,,1), s, "A"&SEQUENCE(,COLUMNS(a)), r, IFERROR(XLOOKUP(t, a, s, ,0),t), index, DROP(REDUCE(0, r, LAMBDA(acuArr,newItem, HSTACK(acuArr, TAKE(acuArr,1,-1)+IF(LEFT(newItem,1)="A", 1, 0)))), ,1), v, VALUE(TEXTSPLIT(TEXTJOIN(" - ", ,GA)," - ")), Aarr, HSTACK(v, v, v, v, v, v, v, v), i, IF(LEFT(r,1)="A", "A"&INDEX(Aarr,1, index), r), res, WRAPROWS(BYROW(WRAPROWS(i, 2), LAMBDA(x, TEXTJOIN(" - ",,x))), 16), ress,TAKE(VSTACK(res,res), $B$7), ress )
B4B4=32-B2-B3
B5B5=SUM(B2:B4)
D4:D18D4=WORKDAY(D3,1)
Dynamic array formulas.
 
Upvote 1

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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