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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

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