How to count consecutive values in Excel?

0

At this point I have this formula that calculates consecutive values:

=SE(AB5=0;0;SE(OU(E(AB4>=100;AB5>=100);E(AB4<=-100;AB5<=-100));AC4+1;1))

Basically it does this:

0           0
0           0
-110        1
-110        2
-110        3
-100        4
0           0
0           0
0           0
130         1
150         2
0           0
0           0
-100        1
0           0
0           0
0           0
0           0
-110        1
0           0
0           0
0           0
-220        1
-150        2
0           0
0           0

But I want her to do this:

0           0
0           0
-110        0
-110        0
-110        0
-100        4
0           0
0           0
0           0
130         0
150         2
0           0
0           0
-100        1
0           0
0           0
0           0
0           0
-110        1
0           0
0           0
0           0
-220        0
-150        2
0           0
0           0

Or this:

0           0
0           0
-110        4
-110        0
-110        0
-100        0
0           0
0           0
0           0
130         2
150         0
0           0
0           0
-100        1
0           0
0           0
0           0
0           0
-110        1
0           0
0           0
0           0
-220        2
-150        0
0           0
0           0

What is the formula for making this possible?

I'd rather not have to add more columns because the file is already large ...

Just using a formula to do this job would be the best ...

Thanks for the help.

    
asked by anonymous 05.10.2018 / 23:18

1 answer

0

For the formula does not get very extensive you can use another column to compare lines, two by two, like the image below:

    
06.10.2018 / 17:43