Hi.

I'm trying to count a number of consecutive profit/loss in a collumn
In another post i found this solution which i addapted for my workbook.

Let's say in collumn A i have the following numbers from A2:A12
A2: 0
A3: 2
A4: 1.5
A5: -3.5
A6: 1
A7: 5
A8: 10
A9: 4.5
A10: 0.5
A11:-1
A12: -2


Now to get the max of consecutive positive number i put the nxt array formula in B1:
Formula: copy to clipboard
 =MAX(FREQUENCY(IF(A2:A100>0,ROW(A2:A100)),IF(A2:A100<=0,ROW(A2:A100))))

And this will give me the result 5, which is the max number of consecutive positive numbers.

Now, to get the max sum value in that range i put the next array formula:
Formula: copy to clipboard
=SUM(OFFSET(A1,SMALL(IF(A2:A100<=0,ROW(A2:A100)),MATCH(B1,FREQUENCY(
IF(A2:A100>0,ROW(A2:A100)),IF(A2:A100<=0,ROW(A2:A100))),0))-B1-1,,B1))

And it will say that for the 5 consecutive positive numbers i got the total sum of 21 (1+5+10+4.5+0.5)

Untill here its ok.

But how about negative numbers?
For the first formula its easy. Just replaced the > for < and the <= for >= and it was ok. But for the second formula this was not enough. I don't know if i have to replace the SMALL fucntion or change also the minus on -B1-1 for +. Anyway, just by changing < to > or <= to >= didn't worked, because gave me the error N/A. So, something must be missing.

So if someone could please help me how to put the formula correct i would be really appreciated.
Thank you.