View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Using Macros To Perform Multiple Averages

You could use formulas

if your data is in column B and data/time is in column A add new column and
copy formula down column. INT will match the date. the 1st sumproduct gets
the totals and the 2nd sumproduct gets the number of sqamples for each hour.
the If statement is needed to only get an average for the last sample of each
hour.



=IF(HOUR(A1) <
HOUR(A2),SUMPRODUCT(--(INT(A1)=INT(A$1:A$300)),--(HOUR(A1)=HOUR(A$1:A$300)),B$1:B$300)/SUMPRODUCT(--(INT(A1)=INT(A$1:A$300)),--(HOUR(A1)=HOUR(A$1:A$300))),
"")

"d__o__a" wrote:

In my Excel file i have over 1000 rows of data. This contains temperatures
measured each minute for each hour for each day over a month. Yes i know
that's a lot of data!

I want to be able to get an average hourly temperature for each hour of the
day as a way to simplify my spreadsheet. So basically what i want to do is
average the temperatures recorded between 9:00am and 9:59am for 9/3/2009, and
do the same thing for each hour of that day as well as every other day.

Is there a macro or something i can use to speed things up? I have tried
doing it the long way and it is of course pain-stakingly slow - in which case
i thought to myself there must be an easier and quicker way to do this!

Can anyone be able to help me?

Thanks,
--Max