Removing the need of a helper column

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
182
Office Version
  1. 2021
Platform
  1. Windows
Good morning, yesterday I posed a question regarding the attached image and Stephen Crump kindly gave me the perfect solution.

=COUNTIFS(A2:A34,"League",B2:B34,"H",D2:D34,E14)

What has got me thinking is the solution doesn't reference column C at all and as column D is a helper column that refers to Column C, is it possible to "cut out the middle man" completely, meaning I could dispense with the helper column? It would be a great boon if so as the several helper columns (60 in all) really slow the workbook down.

The formula in D3 is =IF(($A3="League")*($B3="H"),IF($C3="W",SUM(1,D2),0),N(D2))

Copied down

Many thanks for any help offered and if it can't be done, so be it. Just wondered.
 

Attachments

  • Mr Excel.JPG
    Mr Excel.JPG
    79.2 KB · Views: 40
There are some ways to eliminate the helper columns. I’ll post something later today after I do a little more testing. Another option would be to abandon a formula approach and use VBA.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
That's very good of you, I'm most grateful. I did have VBA that someone else provided doing the job in an older workbook (4 years ago) that I thought I had lost but have since relocated. However there have been so many changes to the workbook since them, things improved, moved to different pages and cells etc, that I couldn't switch it over. Probably because I've still got my L plates on when it comes to VBA.
 
Upvote 0
Here is a version to take for a test drive. There are two formulas, both very similar. While your original request indicated interest in Home League Wins, I noticed that your summary table includes report sections for "All" match types (not just League), Draws and Losses (not just Wins), and Longest streak (not just a user input minimum). To that end, I've attempted to generalize the formula(s) so that they do not require much editing to adapt to these other types of queries. However, the formula needs some cues that describe which conditions to apply. I'm suggesting that you do use some helper cells, but not for the main data source...no helpers needed there. Rather, some helpers, as shown in the orange cells to the left and above the summary table, indicate on each row whether the formula is to consider results for (A)ll matches, or only (L)eague matches, and whether the streaks examined are for (W)ins, (D)raws, or (L)osses. One comment about the upper and lower summary blocks. In one section of the upper block, "Victories" are to be examined, yet immediately below in the Longest Runs block, matches "Without a Defeat" are to be examined. These are not necessarily equivalent, as the upper would involve a streak of, for example, WWWW; while the lower block could, based on that wording, consider a streak of WDDW (no losses, only wins and draws). I've assumed you want the same Win, Loss, Draw criteria applied to upper and lower sections.

The two formulas shown are not quite duplicates, as the upper needs to return only two outputs, since the user provides the initial. Regarding this initial input, the formula is written to search for any strings that satisfy the match type and location and match outcome criteria...and then find match streaks that are at least as long as the user's input (not necessarily exactly equal to the user's input). Because the upper formula delivers two results, it is copied to the "Times" column and both results spill from there...the total number of streaks and the end date of the most recent streak. The lower formula delivers three results, so it is copied to the "Total" column and all three results spill from there.

The helper cells in orange can be hidden after confirming the formulas are working as desired.

One point about the interpretation of a streak. I've assumed that a consecutive match series like this: League-Home-Win, League-Away-Loss, League-Home-Win would count as a 2-win League-Home streak because the "home" win streak has not been broken by a league home draw or league home loss. Let me know if that is not true; otherwise some significant changes would be needed.

I've also surmised that your actual data are not in columns A,B,C, but rather in J,E,K, and B. I've incorporated this mapping in the formula and describe the actual data locations using dynamically formed arrays...just be sure to set the initial data source range to something overly large...I used All!$B$1:$K$10000. Let me know how this performs compared to your current method. Eliminating the dozens of long helper columns should be beneficial, but you're trading those off for a long formula.
The XL2BB add-in doesn't like my word-wrap column headings in A18 and B18...they are the first two shown here. The other is the Search Box instruction positioned over the table:
(C)onsecutive or (L)ongest
(A)ll or (L)eague
SEARCH BOX (Enter min streak length to find under TOTAL and end date of most recent streak will appear and how many times it's happened)
MrExcel_20240321.xlsx
ABCDEFGHIJKLMNOPQRS
18query match results for (W)in, (D)raw, (L)oss -->WWDDLL
19CONSECUTIVESVICTORIESDRAWSDEFEATSGOALS SCOREDGOALS CONCEDED
20TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
21CAALL2110/03/20242114/02/20242103/03/2024
22CAALLH2129/02/20242 not found2103/02/2024
23CAA2110/03/20242 not found2111/02/2024
24CLALL2101/03/20242114/02/20242103/02/2024
25CLLEAGUEHno entry2 not found2103/02/2024
26CLA3126/02/20242 not found2107/02/2024
27LONGEST RUNS
28
29LAALL7110/03/20242114/02/20242103/03/2024
30LAALLH5129/02/20241113/02/20242103/02/2024
31LAA6110/03/20241127/02/20243111/02/2024
32LLALL5126/02/20242114/02/20242103/02/2024
33LLLEAGUEH6104/03/20241113/02/20242103/02/2024
34LLA3126/02/20241127/02/20242107/02/2024
35
Summary
Cell Formulas
RangeFormula
L21:M26,I21:J26,F26:G26,F25,F21:G24F21=IF(E21="","no entry", LET( src, All!$B$1:$K$10000, lrow, LOOKUP(2,1/(All!$B:$B<>""),ROW(All!$B:$B)), dsrc, All!$B$2:INDEX(All!$K:$K,lrow), data, INDEX(dsrc,SEQUENCE(ROWS(dsrc)),{1,4,9,10}), loc, IF($D21="ALL",SEQUENCE(ROWS(data),,1,0),INDEX(data,,2)=$D21), mtype, IF($B21="A",SEQUENCE(ROWS(data),,1,0),INDEX(data,,3)="League"), qryres, F$18, fdata, FILTER(INDEX(data,SEQUENCE(ROWS(data)),{1,4}),loc*mtype), rfdata, IF(INDEX(fdata,SEQUENCE(ROWS(fdata)),2)=qryres,INDEX(fdata,SEQUENCE(ROWS(fdata)),{1,2}),{"|","|"}), rstr, CONCAT(INDEX(rfdata,,2)), rary, IFERROR(FILTERXML("<x><y>"&SUBSTITUTE(rstr,"|","</y><y>")&"</y></x>","//y"),""), cntr, LEN(rary), maxStrk, MAX(cntr), inpStrk, E21, luStrk, IF($A21="L",maxStrk,inpStrk), idxS, XMATCH(1,--(cntr>=luStrk),0,-1), nwins, LEN(CONCAT(INDEX(rary,SEQUENCE(idxS)))), nstrks, SUM(--(nwins>=luStrk)), lsed, INDEX(FILTER(INDEX(rfdata,,1),INDEX(rfdata,,1)<>"|"),nwins), finres, CHOOSE({1,2},nstrks,lsed), IFERROR(finres,{"","not found"}) ))
E29:M34E29=LET( src, All!$B$1:$K$10000, lrow, LOOKUP(2,1/(All!$B:$B<>""),ROW(All!$B:$B)), dsrc, All!$B$2:INDEX(All!$K:$K,lrow), data, INDEX(dsrc,SEQUENCE(ROWS(dsrc)),{1,4,9,10}), loc, IF($D29="ALL",SEQUENCE(ROWS(data),,1,0),INDEX(data,,2)=$D29), mtype, IF($B29="A",SEQUENCE(ROWS(data),,1,0),INDEX(data,,3)="League"), qryres, E$18, fdata, FILTER(INDEX(data,SEQUENCE(ROWS(data)),{1,4}),loc*mtype), rfdata, IF(INDEX(fdata,SEQUENCE(ROWS(fdata)),2)=qryres,INDEX(fdata,SEQUENCE(ROWS(fdata)),{1,2}),{"|","|"}), rstr, CONCAT(INDEX(rfdata,,2)), rary, IFERROR(FILTERXML("<x><y>"&SUBSTITUTE(rstr,"|","</y><y>")&"</y></x>","//y"),""), cntr, LEN(rary), maxStrk, MAX(cntr), inpStrk, "enter cell address here", luStrk, IF($A29="L",maxStrk,inpStrk), idxS, XMATCH(1,--(cntr>=luStrk),0,-1), nwins, LEN(CONCAT(INDEX(rary,SEQUENCE(idxS)))), nstrks, SUM(--(nwins>=luStrk)), lsed, INDEX(FILTER(INDEX(rfdata,,1),INDEX(rfdata,,1)<>"|"),nwins), finres, CHOOSE({1,2,3},luStrk,nstrks,lsed), IFERROR(finres,{"","","not found"}) )
Dynamic array formulas.

Data used for the above results:
MrExcel_20240321.xlsx
BEJK
1DateLocation (B)Match Type (A)Result (C)
21-FebALeagueW
32-FebHLeagueL
43-FebHLeagueL
54-FebHLeagueW
65-FebALeagueL
76-FebHLeagueW
87-FebALeagueL
98-FebHLeagueW
109-FebHLeagueW
1110-FebHFA CupW
1211-FebAFA CupL
1312-FebALeagueW
1413-FebHLeagueD
1514-FebALeagueD
1615-FebHLeagueW
1716-FebHLeagueL
1817-FebALeagueW
1918-FebALeagueL
2019-FebHLeagueW
2120-FebHLeagueW
2221-FebALeagueD
2322-FebHLeagueW
2423-FebALeagueW
2524-FebHLeagueW
2625-FebALeagueW
2726-FebALeagueW
2827-FebALeagueD
2928-FebALeagueL
3029-FebHLeagueW
311-MarALeagueW
322-MarHFA CupL
333-MarALeagueL
344-MarHLeagueW
355-MarAFA CupW
366-MarAFA CupW
377-MarAFA CupW
388-MarAFA CupW
399-MarAFA CupW
4010-MarAFA CupW
All
 
Upvote 0
Wow, you must have spent some time on that, thank you very much. I'll get right into this morning.

To answer your questions, the two blocks are asking different questions. Consecutive runs and longest runs are not the same for the reasons you mentioned.

To show you the difference, these are the club records and as you can see each section has entirely different results. So I think we are on the right track.

Cobblers.xlsm
ABCDEFGHIJKLMNOPQ
1ALL-TIME RECORDS
2CONSECUTIVESVICTORIESDRAWSDEFEATSGOALS SCOREDGOALS CONCEDED
3TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
4ALL COMPSALL11128/12/1899621983 & 2011741972, 1985, 1988 & 199228103/10/190829128/12/1965
5HOME14116/04/19275121/03/1981621985 & 200254128/01/092816113/10/1900
6AWAY622004 & 2015421913 & 199416127/10/190619127/03/195940101/09/1926
7LEAGUE ONLYALL11128/12/1899621983 & 20118126/10/193528129/08/201527128/09/1965
8HOME1221899 & 20275121/03/1981551905, 1985, 1999, 2002 & 201675128/12/192619113/10/1900
9AWAY8121/11/20155106/09/199415127/10/190618127/03/195942120/02/1965
10LONGEST RUNSWITHOUT A DEFEATWITHOUT DRAWWITHOUT A VICTORYNO GOALS CONCEDEDNO GOALS SCORED
11TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
12ALL COMPSALL27123/01/201629105/02/19271921969 & 1993621910 & 19307107/04/1939
13HOME33122/02/191328131/08/195711117/01/19909125/08/19236114/12/2002
14AWAY14113/02/201621112/04/190828127/01/19066112/04/1997721938 & 1995
15LEAGUE ONLYALL31128/12/201529105/02/19271821969 & 2011621930 & 19757107/04/1939
16HOME33122/02/19132621898 & 198411117/01/19909125/08/19235114/12/2002
17AWAY19131/10/201523130/04/196633101/01/19216112/04/19978128/03/1967
Records
Cell Formulas
RangeFormula
C4C4=LET(t,ALL!$K:$K,s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="W",s),IF(t<>"W",s))))
C5C5=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="H"),MAX(FREQUENCY(IF(t="W",SEQUENCE(ROWS(t))),IF(t<>"W",SEQUENCE(ROWS(t))))))
C6C6=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="A"),MAX(FREQUENCY(IF(t="W",SEQUENCE(ROWS(t))),IF(t<>"W",SEQUENCE(ROWS(t))))))
C7C7=LET(t,FILTER(ALL!$K:$K,ALL!$J:$J="League"),MAX(FREQUENCY(IF(t="W",SEQUENCE(ROWS(t))),IF(t<>"W",SEQUENCE(ROWS(t))))))
C8C8=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="W",s),IF(t<>"W",s))))
C9C9=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="W",s),IF(t<>"W",s))))
F4F4=LET(t,ALL!$K:$K,s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="D",s),IF(t<>"D",s))))
F5F5=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="H"),MAX(FREQUENCY(IF(t="D",SEQUENCE(ROWS(t))),IF(t<>"D",SEQUENCE(ROWS(t))))))
F6F6=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="A"),MAX(FREQUENCY(IF(t="D",SEQUENCE(ROWS(t))),IF(t<>"D",SEQUENCE(ROWS(t))))))
F7F7=LET(t,FILTER(ALL!$K:$K,ALL!$J:$J="League"),MAX(FREQUENCY(IF(t="D",SEQUENCE(ROWS(t))),IF(t<>"D",SEQUENCE(ROWS(t))))))
F8F8=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="D",s),IF(t<>"D",s))))
F9F9=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="D",s),IF(t<>"D",s))))
I4I4=LET(t,ALL!K:K,s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="L",s),IF(t<>"L",s))))
I5I5=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="H"),MAX(FREQUENCY(IF(t="L",SEQUENCE(ROWS(t))),IF(t<>"L",SEQUENCE(ROWS(t))))))
I6I6=LET(t,FILTER(ALL!$K:$K,ALL!$E:$E="A"),MAX(FREQUENCY(IF(t="L",SEQUENCE(ROWS(t))),IF(t<>"L",SEQUENCE(ROWS(t))))))
I7I7=LET(t,FILTER(ALL!$K:$K,ALL!$J:$J="League"),MAX(FREQUENCY(IF(t="L",SEQUENCE(ROWS(t))),IF(t<>"L",SEQUENCE(ROWS(t))))))
I8I8=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="L",s),IF(t<>"L",s))))
I9I9=LET(t,FILTER(ALL!$K:$K,(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t="L",s),IF(t<>"L",s))))
L4L4=LET(t,ALL!L:L,s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>0,s),IF(t=0,s))))
L5L5=LET(t,FILTER(ALL!L:L,ALL!$E:$E="H"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
L6L6=LET(t,FILTER(ALL!L:L,ALL!E:E="A"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
L7L7=LET(t,FILTER(ALL!$L:$L,ALL!$J:$J="League"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
L8L8=LET(t,FILTER(ALL!$L:$L,(ALL!$J:$J="League")*(ALL!$E:$E="H")),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
L9L9=LET(t,FILTER(ALL!$L:$L,(ALL!$J:$J="League")*(ALL!$E:$E="A")),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
O4O4=LET(t,ALL!$M:$M,s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>0,s),IF(t=0,s))))
O5O5=LET(t,FILTER(ALL!M:M,ALL!$E:$E="H"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
O6O6=LET(t,FILTER(ALL!M:M,ALL!E:E="A"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
O7O7=LET(t,FILTER(ALL!$M:$M,ALL!$J:$J="League"),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
O8O8=LET(t,FILTER(ALL!$M:$M,(ALL!$J:$J="League")*(ALL!$E:$E="H")),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
O9O9=LET(t,FILTER(ALL!$M:$M,(ALL!$J:$J="League")*(ALL!$E:$E="A")),MAX(FREQUENCY(IF(t<>0,SEQUENCE(ROWS(t))),IF(t=0,SEQUENCE(ROWS(t))))))
C12C12=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
C13C13=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
C14C14=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
C15C15=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
C16C16=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
C17C17=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"L",s),IF(t="L",s))))
F12F12=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
F13F13=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
F14F14=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
F15F15=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
F16F16=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
F17F17=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"D",s),IF(t="D",s))))
I12I12=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
I13I13=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
I14I14=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
I15I15=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
I16I16=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
I17I17=LET(t,FILTER(ALL!$K:$K,(ALL!$K:$K<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t<>"W",s),IF(t="W",s))))
L12L12=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
L13L13=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
L14L14=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
L15L15=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")*(ALL!$J:$J="League")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
L16L16=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
L17L17=LET(t,FILTER(ALL!$M:$M,(ALL!$M:$M<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O12O12=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O13O13=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O14O14=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O15O15=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")*(ALL!$J:$J="League")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O16O16=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="H")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
O17O17=LET(t,FILTER(ALL!$L:$L,(ALL!$L:$L<>"")*(ALL!$J:$J="League")*(ALL!$E:$E="A")),s,SEQUENCE(ROWS(t)),MAX(FREQUENCY(IF(t=0,s),IF(t<>0,s))))
 
Upvote 0
So I've made a start to this, after adding the helper columns and placing 11 in E22, I've placed the formula in F21 and its returning "Not Found". I guess I've either made a mistake or I've not prepared the ground correctly.
New Cobblers.xlsm
ABCDEFGHIJKLMNOPQRS
18SEARCH BOX (Enter amount of games required under TOTAL and date of most recent record will appear and how many times its happened)
19WWDDLL
20CONSECUTIVESVICTORIESDRAWSDEFEATSGOALS SCOREDGOALS CONCEDED
21TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
22CAALL11 not found        
23CAALLH          
24CAA          
25CLALL          
26CLLEAGUEH          
27CLA          
28LONGEST RUNSWITHOUT A DEFEATWITHOUT DRAWWITHOUT A VICTORYNO GOALS CONCEDEDNO GOALS SCORED
29TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
30LAALL          
31LAALLH          
32LAA          
33LLALL          
34LLLEAGUEH          
35LLA          
Records
Cell Formulas
RangeFormula
F22:G22F22=IF(E21="","no entry", LET( src, ALL!$B$1:$K$10000, lrow, LOOKUP(2,1/(ALL!$B:$B<>""),ROW(ALL!$B:$B)), dsrc, ALL!$B$2:INDEX(ALL!$K:$K,lrow), data, INDEX(dsrc,SEQUENCE(ROWS(dsrc)),{1,4,9,10}), loc, IF($D21="ALL",SEQUENCE(ROWS(data),,1,0),INDEX(data,,2)=$D21), mtype, IF($B21="A",SEQUENCE(ROWS(data),,1,0),INDEX(data,,3)="League"), qryres, F$18, fdata, FILTER(INDEX(data,SEQUENCE(ROWS(data)),{1,4}),loc*mtype), rfdata, IF(INDEX(fdata,SEQUENCE(ROWS(fdata)),2)=qryres,INDEX(fdata,SEQUENCE(ROWS(fdata)),{1,2}),{"|","|"}), rstr, CONCAT(INDEX(rfdata,,2)), rary, IFERROR(FILTERXML("<x><y>"&SUBSTITUTE(rstr,"|","</y><y>")&"</y></x>","//y"),""), cntr, LEN(rary), maxStrk, MAX(cntr), inpStrk, E21, luStrk, IF($A21="L",maxStrk,inpStrk), idxS, XMATCH(1,--(cntr>=luStrk),0,-1), nwins, LEN(CONCAT(INDEX(rary,SEQUENCE(idxS)))), nstrks, SUM(--(nwins>=luStrk)), lsed, INDEX(FILTER(INDEX(rfdata,,1),INDEX(rfdata,,1)<>"|"),nwins), finres, CHOOSE({1,2},nstrks,lsed), IFERROR(finres,{"","not found"}) ))
I22I22=IF(H22="","",COUNTIFS(ALL!$AI$2:$AI$5558,H22))
J22J22=IF(H22="","",LET(XL,XLOOKUP(H22,ALL!$AI$2:$AI$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I23I23=IF(H23="","",COUNTIFS(ALL!$E$2:$E$5558,$D$23,ALL!$AN$2:$AN$5558,H23))
J23J23=IF(H23="","",LET(XL,XLOOKUP(H23,ALL!$AN$2:$AN$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I24I24=IF(H24="","",COUNTIFS(ALL!$E$2:$E$5558,$D$24,ALL!$AS$2:$AS$5558,H24))
J24J24=IF(H24="","",LET(XL,XLOOKUP(H24,ALL!$AS$2:$AS$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I25I25=IF(H25="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$AX$2:$AX$5558,H25))
J25J25=IF(H25="","",LET(XL,XLOOKUP(H25,ALL!$AX$2:$AX$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I26I26=IF(H26="","",COUNTIFS(ALL!$J2:$J5558,C26,ALL!$E2:$E5558,D26,ALL!$BC$2:$BC$5558,H26))
J26J26=IF(H26="","",LET(XL,XLOOKUP(H26,ALL!$BC$2:$BC$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I27I27=IF(H27="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$27,ALL!$BH$2:$BH$5558,H27))
J27J27=IF(H27="","",LET(XL,XLOOKUP(H27,ALL!$BH$2:$BH$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L22L22=IF(K22="","",COUNTIFS(ALL!$AJ$2:$AJ$5558,K22))
M22M22=IF(K22="","",LET(XL,XLOOKUP(K22,ALL!$AJ$2:$AJ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L23L23=IF(K23="","",COUNTIFS(ALL!$E$2:$E$5558,$D$23,ALL!$AO$2:$AO$5558,K23))
M23M23=IF(K23="","",LET(XL,XLOOKUP(K23,ALL!$AO$2:$AO$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L24L24=IF(K24="","",COUNTIFS(ALL!$E$2:$E$5558,$D$24,ALL!$AT$2:$AT$5558,K24))
M24M24=IF(K24="","",LET(XL,XLOOKUP(K24,ALL!$AT$2:$AT$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L25L25=IF(K25="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$AY$2:$AY$5558,K25))
M25M25=IF(K25="","",LET(XL,XLOOKUP(K25,ALL!$AY$2:$AY$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L26L26=IF(K26="","",COUNTIFS(ALL!$J2:$J5558,$C$26,ALL!$E2:$E5558,$D$26,ALL!$BD$2:$BD$5558,K26))
M26M26=IF(K26="","",LET(XL,XLOOKUP(K26,ALL!$BD$2:$BD$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L27L27=IF(K27="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$27,ALL!$BI$2:$BI$5558,K27))
M27M27=IF(K27="","",LET(XL,XLOOKUP(K27,ALL!$BI$2:$BI$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O22O22=IF(N22="","",COUNTIFS(ALL!$AK$2:$AK$5558,N22))
P22P22=IF(N22="","",LET(XL,XLOOKUP(N22,ALL!$AK$2:$AK$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O23O23=IF(N23="","",COUNTIFS(ALL!$E$2:$E$5558,$D$23,ALL!$AP$2:$AP$5558,N23))
P23P23=IF(N23="","",LET(XL,XLOOKUP(N23,ALL!$AP$2:$AP$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O24O24=IF(N24="","",COUNTIFS(ALL!$E$2:$E$5558,$D$24,ALL!$AU$2:$AU$5558,N24))
P24P24=IF(N24="","",LET(XL,XLOOKUP(N24,ALL!$AU$2:$AU$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O25O25=IF(N25="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$AZ$2:$AZ$5558,N25))
P25P25=IF(N25="","",LET(XL,XLOOKUP(N25,ALL!$AZ$2:$AZ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O26O26=IF(N26="","",COUNTIFS(ALL!$J2:$J5558,$C$26,ALL!$E2:$E5558,$D$26,ALL!$BE$2:$BE$5558,N26))
P26P26=IF(N26="","",LET(XL,XLOOKUP(N26,ALL!$BE$2:$BE$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O27O27=IF(N27="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$27,ALL!$BJ$2:$BJ$5558,N27))
P27P27=IF(N27="","",LET(XL,XLOOKUP(N27,ALL!$BJ$2:$BJ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R22R22=IF(Q22="","",COUNTIFS(ALL!$AL$2:$AL$5558,Q22))
S22S22=IF(Q22="","",LET(XL,XLOOKUP(Q22,ALL!$AL$2:$AL$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R23R23=IF(Q23="","",COUNTIFS(ALL!$E$2:$E$5558,$D$23,ALL!$AQ$2:$AQ$5558,Q23))
S23S23=IF(Q23="","",LET(XL,XLOOKUP(Q23,ALL!$AQ$2:$AQ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R24R24=IF(Q24="","",COUNTIFS(ALL!$E$2:$E$5558,$D$24,ALL!$AV$2:$AV$5558,Q24))
S24S24=IF(Q24="","",LET(XL,XLOOKUP(Q24,ALL!$AV$2:$AV$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R25R25=IF(Q25="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$BA$2:$BA$5558,Q25))
S25S25=IF(Q25="","",LET(XL,XLOOKUP(Q25,ALL!$BA$2:$BA$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R26R26=IF(Q26="","",COUNTIFS(ALL!$J2:$J5558,$C$26,ALL!$E2:$E5558,$D$26,ALL!$BF$2:$BF$5558,Q26))
S26S26=IF(Q26="","",LET(XL,XLOOKUP(Q26,ALL!$BF$2:$BF$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R27R27=IF(Q27="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$27,ALL!$BK$2:$BK$5558,Q27))
S27S27=IF(Q27="","",LET(XL,XLOOKUP(Q27,ALL!$BK$2:$BK$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F23F23=IF(E23="","",COUNTIFS(ALL!$E$2:$E$5558,$D$23,ALL!$AM$2:$AM$5558,E23))
G23G23=IF(E23="","",LET(XL,XLOOKUP(E23,ALL!$AM$2:$AM$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F24F24=IF(E24="","",COUNTIFS(ALL!$E$2:$E$5558,$D$24,ALL!$AR$2:$AR$5558,E24))
G24G24=IF(E24="","",LET(XL,XLOOKUP(E24,ALL!$AR$2:$AR$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F25F25=IF(E25="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$AW$2:$AW$5558,E25))
G25G25=IF(E25="","",LET(XL,XLOOKUP(E25,ALL!$AW$2:$AW$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F26F26=IF(E26="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$26,ALL!$BB$2:$BB$5558,E26))
G26G26=IF(E26="","",LET(XL,XLOOKUP(E26,ALL!$BB$2:$BB$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F27F27=IF(E27="","",COUNTIFS(ALL!$J$2:$J$5558,$C$26,ALL!$E$2:$E$5558,$D$27,ALL!$BG$2:$BG$5558,E27))
G27G27=IF(E27="","",LET(XL,XLOOKUP(E27,ALL!$BG$2:$BG$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F30F30=IF(E30="","",COUNTIFS(ALL!$BL$2:$BL$5558,E30))
G30G30=IF(E30="","",LET(XL,XLOOKUP(E30,ALL!$BL$2:$BL$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F31F31=IF(E31="","",COUNTIFS(ALL!$E$2:$E$5558,$D$31,ALL!$BQ$2:$BQ$5558,E31))
G31G31=IF(E31="","",LET(XL,XLOOKUP(E31,ALL!$BQ$2:$BQ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F32F32=IF(E32="","",COUNTIFS(ALL!$E$2:$E$5558,$D$32,ALL!$BV$2:$BV$5558,E32))
G32G32=IF(E32="","",LET(XL,XLOOKUP(E32,ALL!$BV$2:$BV$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F33F33=IF(E33="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$CA$2:$CA$5558,E33))
G33G33=IF(E33="","",LET(XL,XLOOKUP(E33,ALL!$CA$2:$CA$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F34F34=IF(E34="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$34,ALL!$CF$2:$CF$5558,E34))
G34G34=IF(E34="","",LET(XL,XLOOKUP(E34,ALL!$CF$2:$CF$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
F35F35=IF(E35="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$35,ALL!$CK$2:$CK$5558,E35))
G35G35=IF(E35="","",LET(XL,XLOOKUP(E35,ALL!$CK$2:$CK$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I30I30=IF(H30="","",COUNTIFS(ALL!$BM$2:$BM$5558,H30))
J30J30=IF(H30="","",LET(XL,XLOOKUP(H30,ALL!$BM$2:$BM$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I31I31=IF(H31="","",COUNTIFS(ALL!$E$2:$E$5558,$D$31,ALL!$BR$2:$BR$5558,H31))
J31J31=IF(H31="","",LET(XL,XLOOKUP(H31,ALL!$BR$2:$BR$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I32I32=IF(H32="","",COUNTIFS(ALL!$E$2:$E$5558,$D$32,ALL!$BW$2:$BW$5558,H32))
J32J32=IF(H32="","",LET(XL,XLOOKUP(H32,ALL!$BW$2:$BW$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I33I33=IF(H33="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$CB$2:$CB$5558,H33))
J33J33=IF(H33="","",LET(XL,XLOOKUP(H33,ALL!$BC$2:$CB$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I34I34=IF(H34="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$34,ALL!$CG$2:$CG$5558,H34))
J34J34=IF(H34="","",LET(XL,XLOOKUP(H34,ALL!$CG$2:$CG$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
I35I35=IF(H35="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$35,ALL!$CL$2:$CL$5558,H35))
J35J35=IF(H35="","",LET(XL,XLOOKUP(H35,ALL!$CL$2:$CL$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L30L30=IF(K30="","",COUNTIFS(ALL!$BN$2:$BN$5558,K30))
M30M30=IF(K30="","",LET(XL,XLOOKUP(K30,ALL!$BN$2:$BN$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L31L31=IF(K31="","",COUNTIFS(ALL!$E$2:$E$5558,$D$31,ALL!$BS$2:$BS$5558,K31))
M31M31=IF(K31="","",LET(XL,XLOOKUP(K31,ALL!$BS$2:$BS$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L32L32=IF(K32="","",COUNTIFS(ALL!$E$2:$E$5558,$D$32,ALL!$BX$2:$BX$5558,K32))
M32M32=IF(K32="","",LET(XL,XLOOKUP(K32,ALL!$BX$2:$BX$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L33L33=IF(K33="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$CC$2:$CC$5558,K33))
M33M33=IF(K33="","",LET(XL,XLOOKUP(K33,ALL!$CC$2:$CC$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L34L34=IF(K34="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$34,ALL!$CH$2:$CH$5558,K34))
M34M34=IF(K34="","",LET(XL,XLOOKUP(K34,ALL!$CH$2:$CH$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
L35L35=IF(K35="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$35,ALL!$CM$2:$CM$5558,K35))
M35M35=IF(K35="","",LET(XL,XLOOKUP(K35,ALL!$CM$2:$CM$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O30O30=IF(N30="","",COUNTIFS(ALL!$BO$2:$BO$5558,N30))
P30P30=IF(N30="","",LET(XL,XLOOKUP(N30,ALL!$BO$2:$BO$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O31O31=IF(N31="","",COUNTIFS(ALL!$E$2:$E$5558,$D$31,ALL!$BT$2:$BT$5558,N31))
P31P31=IF(N31="","",LET(XL,XLOOKUP(N31,ALL!$BT$2:$BT$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O32O32=IF(N32="","",COUNTIFS(ALL!$E$2:$E$5558,$D$32,ALL!$BY$2:$BY$5558,N32))
P32P32=IF(N32="","",LET(XL,XLOOKUP(N32,ALL!$BY$2:$BY$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O33O33=IF(N33="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$CD$2:$CD$5558,N33))
P33P33=IF(N33="","",LET(XL,XLOOKUP(N33,ALL!$CD$2:$CD$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O34O34=IF(N34="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$34,ALL!$CI$2:$CI$5558,N34))
P34P34=IF(N34="","",LET(XL,XLOOKUP(N34,ALL!$CI$2:$CI$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
O35O35=IF(N35="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$35,ALL!$CN$2:$CN$5558,N35))
P35P35=IF(N35="","",LET(XL,XLOOKUP(N35,ALL!$CN$2:$CN$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R30R30=IF(Q30="","",COUNTIFS(ALL!$BP$2:$BP$5558,Q30))
S30S30=IF(Q30="","",LET(XL,XLOOKUP(Q30,ALL!$BP$2:$BP$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R31R31=IF(Q31="","",COUNTIFS(ALL!$E$2:$E$5558,$D$31,ALL!$BU$2:$BU$5558,Q31))
S31S31=IF(Q31="","",LET(XL,XLOOKUP(Q31,ALL!$BU$2:$BU$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R32R32=IF(Q32="","",COUNTIFS(ALL!$E$2:$E$5558,$D$32,ALL!$BZ$2:$BZ$5558,Q32))
S32S32=IF(Q32="","",LET(XL,XLOOKUP(Q32,ALL!$BZ$2:$BZ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R33R33=IF(Q33="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$CE$2:$CE$5558,Q33))
S33S33=IF(Q33="","",LET(XL,XLOOKUP(Q33,ALL!$CE$2:$CE$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R34R34=IF(Q34="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$34,ALL!$CJ$2:$CJ$5558,Q34))
S34S34=IF(Q34="","",LET(XL,XLOOKUP(Q34,ALL!$CJ$2:$CJ$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
R35R35=IF(Q35="","",COUNTIFS(ALL!$J$2:$J$5558,$C$34,ALL!$E$2:$E$5558,$D$35,ALL!$CO$2:$CO$5558,Q35))
S35S35=IF(Q35="","",LET(XL,XLOOKUP(Q35,ALL!$CO$2:$CO$5558,ALL!$B$2:$B$5558,,0,-1),HYPERLINK(CELL("address",XL),XL)))
Dynamic array formulas.
 
Upvote 0
I'll have a look at this in more detail either later today or over the weekend. I may not have the correct understanding of the difference between the upper section and lower section. Let's consider League Only Home matches to simplify the discussion. I thought cell C8 was for a user input...the user inputs the minimum streak length that is sought, and the formula looks back at the data table and does two things: 1) it counts the number of League~Home streaks that consist of only W's and whose streak length is greater than or equal to the C8 input value; and 2) it reports the date when the last of those streaks ended.

But I see that you have a formula in cell C8, so C8 must not be for a user input. If this is true, then what does the note mean in the image included in post 14 beside the "Search Box" heading instructing the user to "Enter the amount of games required under TOTAL..."?

Based on the formulas shown in post 24, it appears that you want the upper section to report on the maximum streak length, where the streak consists only of W's (for cell C8); whereas for C18, the streak may contain W's and D's (draws), because both of those outcomes satisfy the "Without a Defeat" definition. Is this correct? This is the fundamental point I was trying to make previously when mentioning the differences between upper and lower blocks, and I'm not sure my understanding is correct.

I like the use of FREQUENCY here in your formulas, and if I can get some clarity on the upper/lower objectives, I think a hybrid solution that takes some ideas from my posts and the formulas in your most recent posts can deliver the desired results without extensive helper cells.

Another item to clarify, please: I see the Start/End Date columns sometimes include multiple years, and in other cases dates in dd/mm/yyyy format. I thought you wanted the most recent date. Are you really interested in a complete list of dates for the streaks?
 
Upvote 0
Hi Again, So the All-Time records are just that, All those totals have never been beaten. You don't enter anything into the cells, they are static unless one of these historical records are beaten. The formula is just finding where that record is. When the record occurred on just one occasion, I have a HYPERLINK to the record (date). When the record happened more than once (one record is 5 times), I just manually enter the year. Just haven't got the room within the box to link to all the dates.

Using the search box, the idea is you can enter the amount of games you like to find how many times the feat (say 5 home wins consecutively) have happened and when was the most recent. This is because people will ask that question if we were to win 5 homes games consecutively. "When did that last happen?" The search box will tell me.

The difference between consecutives and longest runs is that if you take winning games for an example, for consecutives you are looking for exactly that, consecutive winning games, perhaps with the criteria of League games away from home. Longest runs are different. You are looking for consecutive games where two components are missing. So when was the last time we were beaten? Well, that would include both wins and draws, you are looking for a defeat. That question is not covered in the consecutives section.

I hope that is a good enough explanation? Many thanks again for taking an interest.
 
Upvote 0
For the sake of keeping the data source to some manageable size while testing out various input combinations, I've put together this small working example. Details of the formula components follow. If this delivers expected results it can be readily adapted to your summary tables.

The first several expressions inside the LET function involved mapping certain ranges to the formula. Aside from the main source data, the queries depend on knowing four inputs: the match location [(H)ome or (A)way], the match type [League or All], the match outcome used to filter results [(W)in or (L)oss or (D)raw], and the calculation type indicating whether a consecutive string of outcomes is sought [wOnly...with only the specified outcomes] or whether a consecutive string of outcomes is sought that excludes the opposite outcome of that specified [woOpp...without the opposite outcome]. These four inputs are found (mostly) in helper lookup cells, which may be hidden after the initial setup:
Excel Formula:
loc, N1,
mt,  N2,
oc,  N3,
ct,  N4,
For testing/debugging purposes, I listed the four inputs down a column, but in practice, loc is integral to the summary table and its value appears on every row (so a formula can read this, making a separate cell unnecessary). The other inputs do require lookup helper cells because the summary table provides clues about what they should be, but the table structure isn't convenient to use the existing row/column headings, as those headings are not present on every row/column. Therefore, mt and ct would be shown in row-by-row lookup cells, and oc is shown above the summary table columns containing the formula.

This calculation type (ct) idea requires that we define what an "opposite" outcome is, and the formula includes this lookup formula:
Excel Formula:
opp, XLOOKUP(oc,{"W","L","D"},{"L","W","D"})
In practice, this means we might want one of the following six streaks:
  • with only consecutive Wins, or longest runs without a Loss
  • with only consecutive Losses, or longest runs without a Win
  • with only consecutive Draws, or longest runs without a Draw
So declaring the consecutive outcome and then declaring the calculation type (either wOnly or woOpp) determines how the data are filtered, and each of these six combinations maps to a subsection of the table. You may very well find more appealing descriptors for these two flavors of calculation types.

The source data is specified as a single overly large range reference, beginning with the 1st row of data, not the column headings, and the column containing match outcomes is used to filter out blanks, which produces a consolidated array of source data called fsrc. Further, fsrc is trimmed to include only the columns needed, establishing a 4-column array called "data". The four columns, in order, are {Date, Location, Match Type, Outcome}.
Excel Formula:
src, $B2:$K10000, 
fsrc, FILTER(src,INDEX(src,,10)<>""),  
data, INDEX(fsrc,SEQUENCE(ROWS(fsrc)),{1,4,9,10}),

For convenience, if all rows of data are needed, a variable called allr_data is established, consisting of a column of 1's.
Excel Formula:
allr_data, SEQUENCE(ROWS(data), , 1, 0),

Then filtering arrays for location and match type are created, either using all rows (if "All" is specified) or matching the input cells:
Excel Formula:
loc_ary, IF(loc = "All", allr_data, INDEX(data, , 2) = loc),
mt_ary, IF(mt = "All", allr_data, INDEX(data, , 3) = mt),

Next, the "data" array is filtered using the loc and mt criteria, and retaining only two columns (for Date and Match Outcome):
Excel Formula:
fd, FILTER(INDEX(data, SEQUENCE(ROWS(data)), {1, 4}), loc_ary * mt_ary),

For reasons that I do not entirely understand, it seems necessary to explicitly describe the rows that need to be used at one place in the next step, so for convenience, an array of row indexes for fd is created:
Excel Formula:
allr_fd, SEQUENCE(ROWS(fd)),

In the next step, fd is revised to overwrite certain entries that serve to break up the fd array of match dates/outcomes into streaks of the desired type. The calculation type (ct) is used to determine whether the comparison should only consider outcomes matching oc, or exclude outcomes not equal to the "opposite" outcome. If this outcome satisfies the criteria, that row in fd remains unchanged, otherwise it is replaced with pipe "|" characters, indicating a break between streaks, and this revised array is called revfd.
Excel Formula:
revfd, IF( SWITCH(ct, "wOnly", INDEX(fd, , 2) = oc, "woOpp", INDEX(fd, , 2) <> opp),  INDEX(fd, allr_fd, {1, 2}),  {"|", "|"} ),

The 2nd column of revfd (the match results meeting the required criteria) is concatenated, yielding strings of match outcomes separated by "|" characters (rstr). It is critical that the match outcomes in data consist of a single letter, as this method depends on examining the length of the text strings. The results string rstr is passed to the FILTERXML function, where it is split apart using the "|" character as a delimiter. This produces a single column array of streak results called rary, each element consisting of either a blank or some string of outcomes associated with a streak (WWDW for example). The length of each streak is determined based on the length of each text string in rary, producing a single column array called ls, which consists of numbers indicating the length of each streak (for example, {0;0;3;3}. From ls, we can readily obtain the maximum streak length (maxs) and the number of times such a streak occurred (nmaxs).
Excel Formula:
rstr, CONCAT(INDEX(revfd, , 2)),
rary, IFERROR(FILTERXML("<x><y>" & SUBSTITUTE(rstr, "|", "</y><y>") & "</y></x>", "//y"), ""),
ls, LEN(rary),
maxs, MAX(ls),
nmaxs, SUM(--(ls = maxs)),

Determining when the streaks occurred is more challenging. I've used a method based on finding the cumulative sum of the ls array. For any given index position (row) in the ls array, the cumulative sum represents the number of dates from the top of the first column in the revfd array, so these individual cumulative sums can be used to retrieve the end date for any streak in revfd. Here is an Excel 2021-compatible method for the cumulative sum of the ls column array.
Excel Formula:
csum_ls, MMULT(--(SEQUENCE(1, ROWS(ls)) <= SEQUENCE(ROWS(ls))), ls),

To find the end date for all streaks having a length of maxs, we determine the row indexes in ls where the maxs value is found, and call this likely shortened array idxs_ls. The idxs_ls array contains an entry for every streak of max length. Then the cumulative sum that corresponds to the idxs_ls values is extracted from the csum_ls array, and this new array is called idxs_dts. Then, returning to the revfd array where the streaks had been broken up using the "|" character, we take the first column (dates), filter it to remove the "|" character, and use the idxs_dts values as row indexes to extract an array of streak end dates, called seds.
Excel Formula:
idxs_ls, FILTER(SEQUENCE(ROWS(ls)), ls = maxs),
idxs_dts, INDEX(csum_ls, idxs_ls),
seds, INDEX(FILTER(INDEX(revfd, , 1), INDEX(revfd, , 1) <> "|"), idxs_dts),

There may be several dates in the seds array, so they are joined together, or compiled, into a text string called dt_comp using TEXTJOIN so that all dates can be delivered to a single cell. Due to concerns with the cell becoming overloaded, only the last streak end date is shown in dd/mm/yyyy format...earlier dates are shown in yyyy format. And an error trap is used to address the situation when only one date is in sed.
Excel Formula:
dt_comp, TEXTJOIN(", ", , IFERROR(TEXT(INDEX(seds, SEQUENCE(nmaxs - 1)), "yyyy"), ""), TEXT(INDEX(seds, nmaxs), "dd/mm/yyyy")),

Finally, all results for the sub-block row are delivered in a single spilling array:
Excel Formula:
IF(maxs = 0, {"none", "", ""}, CHOOSE({1, 2, 3}, maxs, nmaxs, dt_comp))

MrExcel_20240321 (version 1).xlsx
BEJKLMNOPQR
1DateLocationMatch TypeResultmatch locationAllTOTALTIMES DATES
21-FebALeagueWmatch typeLeague322024, 09/02/2024
32-FebHLeagueLoutcomesL
43-FebHLeagueLcalc typewOnly
54-FebHFA CupD
65-FebALeagueL
76-FebHLeagueW
87-FebALeagueL
98-FebHLeagueL
109-FebHLeagueL
1110-FebHFA CupW
1211-FebAFA CupL
1312-FebALeagueW
1413-FebHLeagueD
1514-FebALeagueD
1615-FebHLeagueW
17
Sheet5
Cell Formulas
RangeFormula
P2:R2P2=LET(loc, N1, mt, N2, oc, N3, ct, N4, cmt_oc, "outcomes {(W)in, (L)oss, (D)raw}", cmt_ct, "(wOnly) with only the specified oc, or (woOpp) without the corresponding opposite", src, $B2:$K10000, fsrc, FILTER(src, INDEX(src, , 10) <> ""), data, INDEX(fsrc, SEQUENCE(ROWS(fsrc)), {1,4,9,10}), cmt_data, "{Date, Location, Match Type, Outcome}", opp, XLOOKUP(oc, {"W","L","D"}, {"L","W","D"}), allr_data, SEQUENCE(ROWS(data), , 1, 0), loc_ary, IF(loc = "All", allr_data, INDEX(data, , 2) = loc), mt_ary, IF(mt = "All", allr_data, INDEX(data, , 3) = mt), fd, FILTER(INDEX(data, SEQUENCE(ROWS(data)), {1,4}), loc_ary * mt_ary), cmt_fd, "{Date, Outcome}", allr_fd, SEQUENCE(ROWS(fd)), revfd, IF(SWITCH(ct, "wOnly", INDEX(fd, , 2) = oc, "woOpp", INDEX(fd, , 2) <> opp), INDEX(fd, allr_fd, {1,2}), {"|","|"}), rstr, CONCAT(INDEX(revfd, , 2)), rary, IFERROR(FILTERXML("<x><y>" & SUBSTITUTE(rstr, "|", "</y><y>") & "</y></x>", "//y"), ""), ls, LEN(rary), maxs, MAX(ls), nmaxs, SUM(--(ls = maxs)), csum_ls, MMULT(--(SEQUENCE(1, ROWS(ls)) <= SEQUENCE(ROWS(ls))), ls), idxs_ls, FILTER(SEQUENCE(ROWS(ls)), ls = maxs), idxs_dts, INDEX(csum_ls, idxs_ls), seds, INDEX(FILTER(INDEX(revfd, , 1), INDEX(revfd, , 1) <> "|"), idxs_dts), dt_comp, TEXTJOIN(", ", , IFERROR(TEXT(INDEX(seds, SEQUENCE(nmaxs - 1)), "yyyy"), ""), TEXT(INDEX(seds, nmaxs), "dd/mm/yyyy")), IF(maxs = 0, {"none","",""}, CHOOSE({1,2,3}, maxs, nmaxs, dt_comp)))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
N1ListH,A,All
N2ListLeague,All
N3ListW,L,D
N4ListwOnly,woOpp
 
Upvote 0
Wow. I'll get on that tomorrow, it looks like a huge task. Thank you for taking the time.
 
Upvote 0
Adapted to the All Time Records table...well, the first three sections, it would look like this (and then you could just hide the orange lookup row/columns):
MrExcel_20240321 (version 1).xlsx
ABCDEFGHIJKLMN
2Calculation Type (ct)Match Type (mt)Location (loc)Outcome (oc) -->WDL
3CONSECUTIVESVICTORIESDRAWSDEFEATS
4TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
5wOnlyAllAllALL COMPSALL152024, 2024, 2024, 2024, 15/02/20242114/02/20243109/02/2024
6wOnlyAllHHOME132024, 2024, 15/02/2024122024, 13/02/2024222024, 09/02/2024
7wOnlyAllAAWAY122024, 12/02/20241114/02/20243111/02/2024
8wOnlyLeagueAllLEAGUE ONLYALL142024, 2024, 2024, 15/02/20242114/02/2024322024, 09/02/2024
9wOnlyLeagueHHOME122024, 15/02/20241113/02/2024222024, 09/02/2024
10wOnlyLeagueAAWAY122024, 12/02/20241114/02/20242107/02/2024
11LONGEST RUNSWITHOUT A DEFEATWITHOUT DRAWWITHOUT A VICTORY
12TOTALTIMESSTART/END DATETOTALTIMESSTART/END DATETOTALTIMESSTART/END DATE
13woOppAllAllALL COMPSALL4115/02/20248112/02/20244105/02/2024
14woOppAllHHOME3115/02/20244110/02/20243104/02/2024
15woOppAllAAWAY2114/02/20245112/02/20243111/02/2024
16woOppLeagueAllLEAGUE ONLYALL4115/02/20249112/02/2024322024, 09/02/2024
17woOppLeagueHHOME2115/02/20245109/02/20243113/02/2024
18woOppLeagueAAWAY2114/02/20244112/02/20242107/02/2024
Records
Cell Formulas
RangeFormula
F13:N18,F5:N10F5=LET(loc, $C5, mt, $B5, oc, F$2, ct, $A5, src, Sheet5!$B$2:$K$10000, fsrc, FILTER(src, INDEX(src, , 10) <> ""), data, INDEX(fsrc, SEQUENCE(ROWS(fsrc)), {1,4,9,10}), opp, XLOOKUP(oc, {"W","L","D"}, {"L","W","D"}), allr_data, SEQUENCE(ROWS(data), , 1, 0), loc_ary, IF(loc = "All", allr_data, INDEX(data, , 2) = loc), mt_ary, IF(mt = "All", allr_data, INDEX(data, , 3) = mt), fd, FILTER(INDEX(data, SEQUENCE(ROWS(data)), {1,4}), loc_ary * mt_ary), cmt_fd, "{Date, Outcome}", allr_fd, SEQUENCE(ROWS(fd)), revfd, IF(SWITCH(ct, "wOnly", INDEX(fd, , 2) = oc, "woOpp", INDEX(fd, , 2) <> opp), INDEX(fd, allr_fd, {1,2}), {"|","|"}), rstr, CONCAT(INDEX(revfd, , 2)), rary, IFERROR(FILTERXML("<x><y>" & SUBSTITUTE(rstr, "|", "</y><y>") & "</y></x>", "//y"), ""), ls, LEN(rary), maxs, MAX(ls), nmaxs, SUM(--(ls = maxs)), csum_ls, MMULT(--(SEQUENCE(1, ROWS(ls)) <= SEQUENCE(ROWS(ls))), ls), idxs_ls, FILTER(SEQUENCE(ROWS(ls)), ls = maxs), idxs_dts, INDEX(csum_ls, idxs_ls), seds, INDEX(FILTER(INDEX(revfd, , 1), INDEX(revfd, , 1) <> "|"), idxs_dts), dt_comp, TEXTJOIN(", ", , IFERROR(TEXT(INDEX(seds, SEQUENCE(nmaxs - 1)), "yyyy"), ""), TEXT(INDEX(seds, nmaxs), "dd/mm/yyyy")), IF(maxs = 0, {"none","",""}, CHOOSE({1,2,3}, maxs, nmaxs, dt_comp)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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