title: Conditional cumulative sum as array-formula
body: <p>I have one column with values of which I list the cumulative sum in the results-column. But this needs to happen separately for the three (sorted) categories in the second column!
  <a href="https://i.stack.imgur.com/QZcPu.png" rel="nofollow noreferrer">Screenshot</a></p>
  
  <p>See the example sheet <a href="https://docs.google.com/spreadsheets/d/1MF1cQ_V-RaDzVRCBbLdXbELJTxeukfUOIaX_w4P-aJo/edit?usp=sharing" rel="nofollow noreferrer">here</a>. </p>
  
  <p>I have been trying since hours to solve this rather simple problem without success. Since the formula will be part of an already pretty extensive array-formula it's</p>
  
  <ol>
  <li><p>Mandatory to be an array-formula</p></li>
  <li><p>Best if we can get it to work without further <code>=if()</code> questioning</p></li>
  </ol>
  
  <p>It's very very simple to solve this with a drag-down formula but I can't translate this in to an array-formula for some reason!</p>
  
  <p><code>=SUMIF($B$2:B2,$B$2:B2,$A$2:A2)</code></p>