title: Google Sheet formula for cumulative sum with condition
body: <p>I have a Google Sheet with the following layout:</p>
  
  <pre><code>  Number |  Counted?  |  Cumulative Total
      4    |     Y      |         4
      2    |            |         6
      9    |     Y      |        15
     ...   |    ...     |        ...
  </code></pre>
  
  <p>The first cell in the <strong>Cumulative Total</strong> column is populated with this formula:</p>
  
  <pre><code>=ArrayFormula((SUMIF(ROW(C2:C1000),"&lt;="&amp;ROW(C2:1000),C2:C1000)
  </code></pre>
  
  <p>However this counts all rows in the 'Number' column. How can I make the Cumulative Total only count rows where the <strong>Counted?</strong> cell is <strong>Y</strong>?</p>