COUNTIF Function, reset count if value equals a specific value
<p>I need to list a running count in column A of each occurrence of the value "4A" in column B, but the count needs to reset to 0 if the value in column B equals "2B". </p>

<p>I have attached a sample of my workbook, column A shows how I need the count to operate. I am open to using VB or a formula. </p>

<p><img src="https://i.stack.imgur.com/OaTD7.jpg" alt="enter image description here"></p>

<p>Or in text format:</p>

<pre><code>| A | B  |
+---+----+
| 0 | 2B |
|   | 3A |
| 1 | 4A |
|   | 4B |
|   | 4B |
| 2 | 4A |
|   | 4B |
| 3 | 4A |
|   | 9A |
| 0 | 2B |
|   | 3A |
| 1 | 4A |
|   | 4C |
| 2 | 4A |
|   | 9A |
| 0 | 2B |
|   | 3A |
| 1 | 4A |
|   | 9A |
| 0 | 2B |
|   | 3A |
| 1 | 4A |
|   | 4C |
|   | 9A |
|   | 9B |
|   | 9Z |
</code></pre>