title: Count with criteria for changing column in excel
body: <p>I have a data looks like this:</p>
  
  <p>a  b  c<br>
  1  3  4<br>
  2  3  3<br>
  4  1  2<br>
  2  4  2<br></p>
  
  <p>In another worksheet, I want to do the following calculation:
  whenever A1 returns a (header of data worksheet), count number of items that are smaller and equal to 2 in column "a". (result will be 2)
  if A1 returns b, count number of items that are smaller and equal to 2 in column "b". (result will be 1).
  A1 has already been preset with formula such that it will show a or b or c as conditions changed. </p>
  
  <p>I need the formula to be lean... I actually have 6 headers, so if I keep on using if functions, I will probably have to set 6 if functions in one cell...that can be overwhelming.  index match cannot provide a range to work on...Any suggestion? thanks</p>
  
  <p>I don't know vba. If you could provide a workable vba code, i don't mind. but i don't know how to read it...>.&lt; please provide user manual for that. lol, thank you~</p>