highest 15 values of previous 20 values

How do I sum the 15 highest values of the 20 previous values in a column. My column has many blanks that I don't want to consider and that I can't filter out. The previous 20 values don't always have the same sized data range. More details below.
-------------------------------------------------------------

I have a column with 8760 rows, one for each hour of the year.
sample data
Jan 1, 2010 Hour 1 42
Jan 1, 2010 Hour 2 (blank)
Jan 1, 2010 Hour 3 (blank)
etc.
Jan 2, 2010 Hour 1 73
Jan 2, 2010 Hour 2 blank

Normally, there is a value for every "Hour 1" and the rest of the hours are blank. Unfortunately, I can't filter for nonblanks. I created a formula that allows me find the average of the 15 highest non blank values for "Hour 1" of the previous 20 days. Essentially, I would ask to look for the largest 15 values of the previous 479 cells.

SUM(LARGE(M973:M494),{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15})/15

My problem is that there isn't always a value for Hour 1. If there was a Day where there was a blank for Hour 1, I am finding the average of the 15 highest values for only the 19 days that had values. If 5 of the previous 20 days have blanks for Hour 1, I'm simply getting an average of the 15 days that have a value.

Thanks,

Nick's picture

variable ranges

Check out this tip on variable ranges... it will help you to choose the correct range to sum.

excelexperts.com/Excel-Tips-Moving-Averages