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.

$40
-$20
$25
$10
$5
$41
$32
-$5
$9
-$12

<tbody>
</tbody>


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

$25
$10
$5
$41
$32

<tbody>
</tbody>


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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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:

-$50
$45
$6
$32
$4
$56
$21
-$45
-$12

<tbody>
</tbody>

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:

-$50
$45
$6
$32
$4
$56
$21
-$45
-$12

<tbody>
</tbody>

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,216,765
Messages
6,132,588
Members
449,737
Latest member
naes

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