View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Averages-HLOOKUP??

Beth, I'd approach this differently.

In cells R11:AC11 enter dates such as 1/1/2006, 2/1/2006, 3/1/2006 and
format them any way you like. For instance, the could format as Jan,
Feb, Mar as long as the underlying number is the first day of each
month in the current year.

In cell Q2, enter the first day of the month through which the average
should be calculated. 2/1/2006 would mean calc through Februrary.

Then to calculate the average, use the following formula:

=SUMPRODUCT(($R$11:$AC$11<=Q2)*$R$12:$AC$12)/SUMPRODUCT(--($R$11:$AC$11<=Q2))

The SUMPRODUCT to the left of the slash sums the values in row 12 for
all dates less than or equal to the date in Q2. The SUMPRODUCT to the
right of the slash counts the number of months that are less than or
equal to Q2.

Hope that helps.

- John