title: iterate row by row COUNTIF using ArrayFormula on Google Sheets
body: <p>I am trying to iterate a COUNTIF formula that counts the number of cells in each row containing numbers greater than 4. I am trying to use ArrayFormula to do this but it isn't working.</p>
  
  <p>Unfortunately it counts ALL the cells matching the condition across the entire range B2:G39 resulting in 26 being entered in each row of column K rather than row by row count i.e. number of cells >4 in B2:G2 entered in K2, number of cells >4 in B3:G3 entered in K3</p>
  
  <p>This is the formula</p>
  
  <pre><code>=ARRAY_CONSTRAIN(arrayformula( if( row(H:H)=1, "Number of cells &gt;4",COUNTIF(A2:G39,"&gt;4"))),39,1)
  </code></pre>
  
  <p>Here is a <a href="https://docs.google.com/spreadsheets/d/1eG5yaVwH8ODfaZEZWviEIEVLEEC9L76kJFiyeyJH3i4/edit?usp=sharing" rel="noreferrer">spreadsheet</a> that includes sample data and my formula</p>