Hi folks,
I work with sets of data in which there is data provided for each hour over periods of several years.
I often have to calculate "rolling averages" in which the result displays the average of values over the prior 30 days (the prior 720 hourly entries). That part is easy enough -- on the 721st record (on row 722, since I have a header row), and those further down, I sum the entries of the previous 720 rows from the desired column.
Here's the hitch:
I need to find a way to extend the range under certain conditions.
Specifically, whenever there are no entries during a whole calendar day ((all 24 hourly entries for that particular date are blank), then I need to skip that date and not count it as one of the days in the "30-day" average, and extend the range of rows averaged by an extra day (an extra 24 rows).
This can happen several times in a month. For example, if there are three days with no data entries at all, then I really need to average over the previous 33 days (792 hours / 792 rows), to make up for the 3 days with no data. If there are 7 days with no data, then I really need to average existing entries over 37 days, and so forth.
Is there a good way to set up a calculation to do this?
Desperately needed. Any help much appreciated.
Thanks.
Bookmarks