View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macro for averaging

I don't know what you are refereing to by blank rows.

You can use a formula for getting the averages if you are smart by using the
row number of where the formula is located.

On the summary sheet starting a row 3

the start row on RawData is where X is the Row number

For Row 2
Start Row = (3*(X-2)) + 2
For X:3 = 2 X:4 = 5 X:5 = 8 X:6 = 11

End Row = (3*(X-3)) + 4
For X:3 = 4 X:4 = 7 X:5 = 10 X:6 = 13

So a formula could be for Row 2
=SUM(INDIRECT("RawData!"&((3*(ROW(C2)-2)) + 2)&":"&((3*(ROW(C2)-2)) + 4)))

Row 2


Row 3
This formula will produce =Sum(Indirect("RawData!5:7"))


Row 4
This formula will produce =Sum(Indirect("RawData!8:10"))

Then copy formula dow the column.

"bioyyy" wrote:

Hello All:

Would you please help with macro to average all the data and put in a new
sheet.

1/ "Rawdata" sheet contain all the data
2/ Average 3 rows starting from row 2 to 2000 (let say average row 2 to 4,
and 5-7, so on)
3/ Copy and paste in a new sheet lets called "Summary" at column 3 row2
4/ Delete all the blank rows

Thanks for all your help!