title: How to do an average of a dynamic range in Excel? (VBA?)
body: <p>I have a list in Excel with basically two columns: <code>Date</code> and <code>Value</code>.</p>
  
  <pre><code>Col A     |Col B |Col C|Col D     |Col E
  ----------+------+-----+----------+-----
  Date      |Value |     |Date-range|
  2012/01/01|    10|     |2012/01/01| 8.33
  2012/01/05|     5|     |2012/01/07|
  2012/01/07|    10|     |          |
  2012/01/13|     1|     |          |
  </code></pre>
  
  <p>I want to return the Average between two dates which I would set in two separate cells. Is that possible?</p>
  
  <p>So let's say in Cell D1 I put "2012/01/01" and in Cell D2 I put "2012/01/07". It should return the average of the values in that date range, in this case (10+5+10)/3 = 8.33  </p>
  
  <p>I was able to return the cell (e.g. <code>C100</code>)  for both dates but I don't know how to include them in a range for an average. Or is there an even smarter way to do it?</p>