title: Count cells with certain values which appear between cells with other values
body: <p>I have one row in Excel with a number pattern (each number is in a different cell) like this.</p>
  
  <pre><code>1 0 0 0 2 0 0 1 0 0 0 0 0 3 0 0 0 0 0 0 0 0 2 0 0 0 1
  </code></pre>
  
  <p>(My row has 300 cells).</p>
  
  <p>Definition:</p>
  
  <ul>
  <li>I call a sequence of zeros between non-zero values "0 sequence".</li>
  <li>I call the non-zero value which marks the start and end of a 0 sequence the "mark value" </li>
  </ul>
  
  <p>I want to calculate:</p>
  
  <ul>
  <li>Count for 0 sequence the number of 0. In this example above, the result is: 3, 2, 5, 8, 3 </li>
  <li>Determine the smallest 0 sequence. In the example above, it is 2</li>
  <li>Determine the largest 0 sequence. In the example above, it is 8</li>
  <li><p>Determine the frequency of each 0 sequence. In the example above, it is:</p>
  
  <ul>
  <li><p>Number of 0 sequence for the entire row with length 1: 0</p></li>
  <li><p>Number of 0 sequence for the entire row with length 2: 1</p></li>
  <li><p>Number of 0 sequence for the entire row with length 3: 2</p></li>
  <li><p>Number of 0 sequence for the entire row with length 4: 0</p></li>
  <li><p>Number of 0 sequence for the entire row with length 5: 1</p></li>
  <li><p>Number of 0 sequence for the entire row with length 6: 0</p></li>
  <li><p>Number of 0 sequence for the entire row with length 7: 0</p></li>
  <li><p>Number of 0 sequence for the entire row with length 8: 1</p></li>
  </ul></li>
  </ul>
  
  <p>I tried different Excel formulas like this one: </p>
  
  <pre><code>=ABS(MATCH(D13, B2:B11, 0)-MATCH(D14, B2:B11, 0))-1
  </code></pre>
  
  <p>This formula does not work for mark values ("D13", "D14")  with the same value. It also does not calculate it for more than one 0 sequence.</p>
  
  <p>Any hint, preferably without VBA, would be appreciated.</p>