title: Excel macro by group
body: <p>The table example   </p>
  
  <pre><code>  column1     | column2 |  column3
      --------------------------------------------
                |         |
        A       |     1   |  
        A       |     2   |  
        A       |     3   |
                |         | 
        B       |     4   |  
        B       |     4   |
                |         | 
        C       |     1   |  
        C       |     1   |  
        C       |     5   |  
  </code></pre>
  
  <p>As you can see, they are grouped in the first column, second column is some value.
  I have no knowledge of VB and I haven't been able to figure it out myself for over an hour.</p>
  
  <p>What I want to do:</p>
  
  <p>For each group: </p>
  
  <p>count how many values are less than 2.</p>
  
  <p>If there is 1 or more such values, set column3 in the blank row above the group to <code>(numbers of values under 2 in group / total number of values in group)</code> </p>
  
  <p>If there are none, do nothing.</p>
  
  <p>Output of above table would be:</p>
  
  <pre><code>  column1     | column2 |  column3
      --------------------------------------------
                |         |   1/3
        A       |     1   |  
        A       |     2   |  
        A       |     3   |
                |         | 
        B       |     4   |  
        B       |     4   |
                |         |   2/3
        C       |     1   |  
        C       |     1   |  
        C       |     5   |  
  </code></pre>