Help in counting streaks

dungeon1976

New Member
Joined
Jul 22, 2014
Messages
7
Hello,
I have been working on a spreadsheet to follow my country’s national soccer league.
I want to find a way to count some different streaks for each team.
Here is a sample of what I have so far from A1:AI7:

12345678910111213141516171819202122232425262728293031323334
Team 1DLD
Team 2DLL
Team 3WWL
Team 4WWD
Team 5LLL
Team 6DLL

<tbody>
</tbody>

The numbers on the first row are the Matchdays, D stands for “Draw”, L stands for “Loss” and W stands for “Win”.
All the “blank” cells have a formula that automatically fills each cell with the correct value when the game is played.
I have googled around and found some formulas that appear to be working, but others don’t.
AAKALAMANAOAP
1Current StreakLongest Winning StreakLongest Draw StreakLongest Losing StreakLongest No-win streak (D and L streak)Longest No-lose streak (D and W streak)
2Team 11 D01131
3Team 22 L01230
4Team 31 L20110
5Team 41 D21013
6Team 53 L00330
7Team 62 L01230

<tbody>
</tbody>


AK2: Current Streak
Code:
{=IFERROR(LOOKUP(1E+100,FREQUENCY(IF(B2:AI2=LOOKUP(2,1/(B2:AI2<>""),B2:AI2), COLUMN(B2:AI2)),IF(B2:AI2<>LOOKUP(2,1/(B2:AI2<>""),B2:AI2),IF(B2:AI2<>"",COLUMN(B2:AI2)))))&" "&LOOKUP(2,1/(B2:AI2<>""),B2:AI2),"")}

This one seems to be working.

AL2: Longest Winning Streak
Code:
{=MAX(FREQUENCY(IF ($B2:$AI2="W",COLUMN($B2:$AI2)),IF($B2:$AI2<>"W",COLUMN($B2:$AI2))))}

This one seems to be working.

AM2: Longest Draw Streak
Code:
{=MAX(FREQUENCY(IF($B2:$AI2="D",COLUMN($B2:$AI2)),IF($B2:$AI2<>"D", COLUMN($B2:$AI2))))}

This one seems to be working.

AN2: Longest Losing Streak
Code:
{=MAX(FREQUENCY(IF($B2:$AI2="L",COLUMN($B2:$AI2)),IF($B2:$AI2<>"L",COLUMN($B2:$AI2))))}

This one seems to be working.

AO2: Longest No-win streak (D and L streak)
Code:
{=MAX(FREQUENCY(IF($B2:$AI2<>"W",COLUMN($B2:$AI2)),IF($B2:$AI2="W",COLUMN($B2:$AI2))))-COUNTIF($B2:$AI2,"")}

This one seems to be working but I do not know for sure.

AP2: Longest No-lose streak (D and W streak)
Code:
{=MAX(FREQUENCY(IF($B2:$AI2<>"L",COL($B2:$AI2)),IF($B2:$AI2="L",COL($B2:$AI2))))-COUNTIF($B2:$AI2,"")}

This is not working: AP4 should be 2 and not 0 but on AP5 it is correct. I do not know how to work this out. As all the range is selected I have used the COUNTIF formula to subtract the empty cells otherwise the result would be even stranger…

Would it be possible for you to check if is there anything wrong with these formulas (at least on the last I know there is).

I would like to do this without having to use VBA code.

All help would be appreciated. :)

Thank you.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi
Welcome to the board

Try in AP2:

=MAX(FREQUENCY(IF((B2:AI2="W")+(B2:AI2="D"),COLUMN(B2:AI2)),IF((B2:AI2<>"W")*(B2:AI2<>"D"),COLUMN(B2:AI2))))

This is an array formula, you have to confirm it with CTRL-SHIFT-ENTER.

Copy down
 
Upvote 0
Hi
Welcome to the board

Try in AP2:

=MAX(FREQUENCY(IF((B2:AI2="W")+(B2:AI2="D"),COLUMN(B2:AI2)),IF((B2:AI2<>"W")*(B2:AI2<>"D"),COLUMN(B2:AI2))))

This is an array formula, you have to confirm it with CTRL-SHIFT-ENTER.

Copy down

Thank you for the welcoming. :)

I have tried the formula and it worked like a charm!!!

I have used it on AO2 and it looked like the formula I had was not working properly, so I am using it on AO column.

Have you checked the other formulas I have posted? Is there any way I can simplify them by using the same logic you have used in this one?

Thanks a lot for the help on this one. Please let me know about the others, if possible. :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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