Calculate a winning streak per person

Shales

Board Regular
Joined
Aug 8, 2006
Messages
171
Office Version
  1. 365
Platform
  1. Windows
Hi, I am building a basic data table for some stats on my 5-aside football group for a bit of fun. I am wanting to calculate a current Win Streak per player so I can share the stats with my group before a match.

This is how my basic data recording looks;

1663671012309.png


On another tab, I am summarising the stats per Player;

1663671136754.png


I am looking for a formula that will calculate a current Win Streak by counting the Consecutive Ws from the first sheet of results. I cannot seem to work it out per player.

Any help would be fantastic.

Thank you
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

current Win Streak by counting the Consecutive Ws
Starting from the latest date and counting backwards?
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


Starting from the latest date and counting backwards?
Hi Peter. Yes, starting from the most recent date and working backwards. Thanks.

I will update my Acc details.
 
Upvote 0
Thanks for updating your details. (y)

Yes, starting from the most recent date and working backwards.
Is this the sort of thing you mean then?

22 09 20.xlsm
ABCDEF
1DatePlayersW/LPlayerWin Streak
29/09/2022BiggsyLBiggsy0
39/09/2022GavLGav1
49/09/2022KarlLKarl0
59/09/2022TommyLTommy0
69/09/2022PownsLPowns1
79/09/2022MartinWMartin2
89/09/2022DougWDoug0
99/09/2022HattyWHatty1
109/09/2022JaseWJase1
119/09/2022DaveWDave2
1216/09/2022DougLDarren0
1316/09/2022DarrenLBissy0
1416/09/2022BissyLGuy1
1516/09/2022BiggsyL 
1616/09/2022TommyL 
1716/09/2022GavW 
1816/09/2022GuyW 
1916/09/2022MartinW 
2016/09/2022PownsW 
2116/09/2022DaveW 
Win Streak
Cell Formulas
RangeFormula
E2:E14E2=UNIQUE(B2:B21)
F2:F21F2=IF(E2="","",LET(f,FILTER(C2:C21,B2:B21=E2),IFNA(ROWS(f)-XMATCH("L",f,0,-1),ROWS(f))))
Dynamic array formulas.
 
Upvote 0
Solution
There's a neat solution from Peter_SSs above. I have an older version, så can't use XMATCH. This was my suggestion.

If you sort your data with the most recent game on top, you can then match what row you'll find the most recent loss, using this formula.
Excel Formula:
{=IFERROR(MATCH("L",IF('Games played'!$B$2:$B$40=A2,'Games played'!$C$2:$C$40),0),999)}
I have named the sheet with the results "Games played" and that it should be 39 rows. Just add more if needed. Also, if there is no loss at all, the result is 999, i.e. far down the sheet. Notice that it is a array formula. (ctrl+enter)

Now you know how many rows down you have you first loss. Then you only need to count the number of each name from the top, to the row above this row. I used INDIRECT to make this formula.
Excel Formula:
{=COUNTIF(INDIRECT("'Games played'!$B$1:$B$"&IFERROR(MATCH("L",IF('Games played'!$B$2:$B$40=A1,'Games played'!$C$2:$C$40),0),999)-1),A1)}
 
Upvote 0
@Peter_SSs Amazing! Yes that is what I am after. I took the formula and placed it another tab in my Doc and changed the cell refs etc. It works perfectly. Thank you very much!!

@Gloffo Thank you for your suggestions. I will explore this just to enhance my understandings.

Thank you both : )
 
Upvote 0
@Peter_SSs Amazing! Yes that is what I am after. I took the formula and placed it another tab in my Doc and changed the cell refs etc. It works perfectly. Thank you very much!!
You are very welcome. Thanks for the follow-up. :)

BTW, I suggest that you investigate XL2BB for providing sample data in the future to make it easier for helpers by not having to manually type out sample data to test with. ;)

@Gloffo Thank you for your suggestions. I will explore this just to enhance my understandings.
If you needed to do this without XMATCH, you could also do it like this and avoid both the sorting and the volatile function INDIRECT, like this. (Still need to adapt to different sheets but you are on top of that by the sound of it. :))

22 09 20.xlsm
ABCDEF
1DatePlayersW/LPlayerWin Streak
29/09/2022BiggsyLBiggsy0
39/09/2022GavLGav1
49/09/2022KarlLKarl0
59/09/2022TommyLTommy0
69/09/2022PownsLPowns1
79/09/2022MartinWMartin2
89/09/2022DougWDoug0
99/09/2022HattyWHatty1
109/09/2022JaseWJase1
119/09/2022DaveWDave2
1216/09/2022DougLDarren0
1316/09/2022DarrenLBissy0
1416/09/2022BissyLGuy1
1516/09/2022BiggsyL
1616/09/2022TommyL
1716/09/2022GavW
1816/09/2022GuyW
1916/09/2022MartinW
2016/09/2022PownsW
2116/09/2022DaveW
Win Streak (2)
Cell Formulas
RangeFormula
F2:F14F2=SUMPRODUCT(--(C$2:C$21="W"),--(B$2:B$21=E2),--(ROW(C$2:C$21)>IFERROR(AGGREGATE(14,6,ROW(C$2:C$21)/((B$2:B$21=E2)*(C$2:C$21="L")),1),0)))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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