#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Macro for averaging

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!

  #2   Report Post  
Posted to microsoft.public.excel.misc
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!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22
Default Macro for averaging

Joel:

Great formula. However, the value give me so different if I do manuallly
(average(Rawdata!C2:C4)? Any suggestions

Thanks,



"Joel" wrote:

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!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Macro for averaging

The formula should be

from
average(Rawdata!C2:C4)
to
average(Rawdata!2:4)

You are only averaging 3 cells not the entire row.



I would first try SUM instead of Average to see if sum works. when an
average is performed the number of cells that it divides by may be incorrect.
I'm not sure what criteria excel uses for the division. blank cells may be
making the division incrooect. Also if you have other data in the rows
beside number this may cause problems. Dates will be treated as numbers and
added to the average.

I like using the Evaluate formula tool to help solve problems. Click on cell
with number and then from the menu Tools - formula Auditing - Evaluate
formula..

"bioyyy" wrote:

Joel:

Great formula. However, the value give me so different if I do manuallly
(average(Rawdata!C2:C4)? Any suggestions

Thanks,



"Joel" wrote:

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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Averaging Carlee Excel Worksheet Functions 1 January 29th 08 05:41 AM
averaging & ??? Dee/Daes Excel Worksheet Functions 6 May 5th 06 08:47 PM
Averaging best 15 out of 20? Rando Excel Discussion (Misc queries) 2 December 13th 05 10:01 PM
More Averaging Reggie Excel Worksheet Functions 2 December 30th 04 11:46 AM
Averaging again Reggie Excel Worksheet Functions 3 December 30th 04 07:40 AM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"