Removing the need of a helper column

Marvo

Board Regular
Joined
Nov 27, 2023
Messages
155
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: 29

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
See below for an alternative.
 
Last edited:
Upvote 0
That's more involved because the current approach involves a sequential count moving down the column...working on an alternative. Here is one approach that should work. Enter the League Home Win Streak threshold in D2 and E2 returns the number of streaks >= that value. I left your helper column in this example for convenient reference, but it is not needed. I also split up the win streak by entering an "L" to test the formula.
Book1
ABCDEFG
1League Home Win Streak >=NumberBB
2LeagueAW420
3LeagueHW1
4LeagueHL0
5LeagueHW1
6LeagueAL1
7LeagueHW2
8LeagueAL2
9LeagueHW3
10LeagueHW4
11FA CupAW4
12FA CupAL4
13LeagueAW4
14LeagueHD0
15LeagueAD0
16LeagueHW1
17LeagueHL0
18LeagueAW0
19LeagueAL0
20LeagueHW1
21LeagueHW2
22LeagueAD2
23LeagueHW3
24LeagueAW3
25LeagueHW4
26LeagueAW4
27LeagueAW4
28LeagueAD4
29LeagueAL4
30LeagueHW5
31LeagueAW5
32FA CupHL5
33LeagueAL5
34LeagueHL0
Sheet1
Cell Formulas
RangeFormula
E2E2=LET(str,CONCAT(FILTER($C$2:$C$34,($A$2:$A$34="League")*($B$2:$B$34="H"))),Wstr,FILTERXML("<x><y>"&SUBSTITUTE(SUBSTITUTE(str,"L","</y><y>"),"D","</y><y>")&"</y></x>","//y"),NconW,IFERROR(LEN(Wstr),0),SUM(--(NconW>=D2)))
G2:G34G2=IF(($A2="League")*($B2="H"),IF($C2="W",SUM(1,G1),0),N(G1))
 
Last edited:
Upvote 0
Ignore this post...in the middle of editing
 
Last edited:
Upvote 0
The above uses FILTER to extract the League Home games, then constructs a text string, which might consist of W, L, and D...let me know if anything else might appear there. The text string is then split using L and D as delimiters, leaving only win streaks...text strings consisting of just W's. The length of these strings is counted, and used for the final sum to determine how many exceed your inputted win streak threshold.
 
Upvote 0
Thank you Kirk, I'll get on to it and report back.
 
Upvote 0
Does this work? Change the "12" to your cell reference.

Excel Formula:
=LET(f,FILTER(C2:C34,(A2:A34="League")*(B2:B34="H")),SUM(--(SCAN(0,f,LAMBDA(a,b,IF(b="W",a+1,a)))=12)))
 
Upvote 0
Just to confirm...your profile shows that you're using Excel 2021. Is that current? I ask because the text split operation in my formula uses an older method with the FILTERXML function. In Excel 365 this would be done more easily with TEXTSPLIT, but I don't believe that function is available in your version. Alternatively, in Excel 365, you could perform the sequential row-by-row tally using a LAMBDA function, as @Cubist has just suggested, but that may not be an option for you.
 
Upvote 0
My mistake. I thought I saw 365. Carry on.

EDIT: XL2021 doesn't have the array functions like LET and FILTER either. I guess this is why I assumed you have D365 from Kirk's solution.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,028
Members
449,092
Latest member
ikke

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