Count consecutive wins

livermore

New Member
Joined
Feb 23, 2011
Messages
39
Hello.

I want to count the number of consecutive wins in a table.
Below I have an example.

[TABLE="width: 100"]
<tbody>[TR]
[TD]$40[/TD]
[/TR]
[TR]
[TD]-$20[/TD]
[/TR]
[TR]
[TD]$25[/TD]
[/TR]
[TR]
[TD]$10[/TD]
[/TR]
[TR]
[TD]$5[/TD]
[/TR]
[TR]
[TD]$41[/TD]
[/TR]
[TR]
[TD]$32[/TD]
[/TR]
[TR]
[TD]-$5[/TD]
[/TR]
[TR]
[TD]$9[/TD]
[/TR]
[TR]
[TD]-$12[/TD]
[/TR]
</tbody>[/TABLE]


My goal is to be able to count how many consecutive wins I was able to get.
The example shows 4 consecutive wins

[TABLE="width: 100"]
<tbody>[TR]
[TD]$25[/TD]
[/TR]
[TR]
[TD]$10[/TD]
[/TR]
[TR]
[TD]$5[/TD]
[/TR]
[TR]
[TD]$41[/TD]
[/TR]
[TR]
[TD]$32[/TD]
[/TR]
</tbody>[/TABLE]


I believe I need to use the FREQUENCY function but I'm completely lost regarding the bin.

Can you help me?
What the formula to achieve this?
Thank you.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try:

=MAX(FREQUENCY(IF(A1:A10>0,ROW(A1:A10)),IF(A1:A10<0,ROW(A1:A10))))

with Control+Shift+Enter.
 
Upvote 0
This is it!
Many thanks.

Allow me to do another question.
I have a similar situation as below:

[TABLE="width: 100"]
<tbody>[TR]
[TD]-$50[/TD]
[/TR]
[TR]
[TD]$45[/TD]
[/TR]
[TR]
[TD]$6[/TD]
[/TR]
[TR]
[TD]$32[/TD]
[/TR]
[TR]
[TD]$4[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]$56[/TD]
[/TR]
[TR]
[TD]$21[/TD]
[/TR]
[TR]
[TD]-$45[/TD]
[/TR]
[TR]
[TD]-$12[/TD]
[/TR]
</tbody>[/TABLE]

Using your formula I would get 6 consecutive wins but there's a blank space between $4 and $56.
The formula is not taking the blank space in consideration, which would mean 4 consecutive wins and not 6.

Tried this formula:
=MAX(IF(ISNUMBER(A1:A10),FREQUENCY(IF(A1:A10>0,ROW(A1:A10)),IF(A1:A10<0,ROW(A1:A10)))))

But I'm getting a #N/A result

Regards.
 
Upvote 0
This is it!
Many thanks.

Allow me to do another question.
I have a similar situation as below:

[TABLE="width: 100"]
<tbody>[TR]
[TD]-$50[/TD]
[/TR]
[TR]
[TD]$45[/TD]
[/TR]
[TR]
[TD]$6[/TD]
[/TR]
[TR]
[TD]$32[/TD]
[/TR]
[TR]
[TD]$4[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD]$56[/TD]
[/TR]
[TR]
[TD]$21[/TD]
[/TR]
[TR]
[TD]-$45[/TD]
[/TR]
[TR]
[TD]-$12[/TD]
[/TR]
</tbody>[/TABLE]

Using your formula I would get 6 consecutive wins but there's a blank space between $4 and $56.
The formula is not taking the blank space in consideration, which would mean 4 consecutive wins and not 6.

Tried this formula:
=MAX(IF(ISNUMBER(A1:A10),FREQUENCY(IF(A1:A10>0,ROW(A1:A10)),IF(A1:A10<0,ROW(A1:A10)))))

But I'm getting a #N/A result

Regards.

Just a modification to Eric's Formula. Try this:

Code:
=MAX(FREQUENCY(IF(A1:A10>0,ROW(A1:A10)),IF(A1:A10<=0,ROW(A1:A10))))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,737
Messages
6,180,659
Members
452,992
Latest member
TokugawaIesuma

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