title: How to count consecutive values in Excel?
body: <p>At this moment I have this formula that counts consecutive values:</p>
  
  <pre><code>=IF(AB5=0;0;IF(OR(AND(AB4&gt;=100;AB5&gt;=100);AND(AB4&lt;=-100;AB5&lt;=-100));AC4+1;1))
  </code></pre>
  
  <p>Basically it does this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>But I want it to do this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Or this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>What is the formula to make this possible ?</p>
  
  <p>I prefer not to have to add more columns since the file is already big...</p>
  
  <p>Using only a formula to do this would be the best thing to do.</p>
  
  <p>Thanks.</p>