Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default To find Average

Hello-

There is a requirement in my project to find the average of values in a
sheet. Values starts from A1 and goes till G20 (which keeps changing every
month). For each row we have to find the Average.
For example;
A B C D
-- -- -- --
10 20 10 40
30 40 20 50
50 60 30 60

For Row 'A' we have to find the Average, similarly for 'B','C' and 'D'.

Instead of doing manually is there any code to perform this task by writing
a macro.

Please let me know if you need any further details.

Regards,
Murali. G
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default To find Average

Yes, it is easier to write a function as you suggested. But as i said the
data keeps increasing, instead of writing a formula every month it is better
to write a macro which calculates the average every time by clicking a
button.

Please help.

Regards,
Murali. G

"Sam Wilson" wrote:

Is it not quicker to use =AVERAGE(A1:A20) in cell A21 etc than to write a
macro?


"Murali G" wrote:

Hello-

There is a requirement in my project to find the average of values in a
sheet. Values starts from A1 and goes till G20 (which keeps changing every
month). For each row we have to find the Average.
For example;
A B C D
-- -- -- --
10 20 10 40
30 40 20 50
50 60 30 60

For Row 'A' we have to find the Average, similarly for 'B','C' and 'D'.

Instead of doing manually is there any code to perform this task by writing
a macro.

Please let me know if you need any further details.

Regards,
Murali. G

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default To find Average

why don't you put the avarage function into column A?
so A1:= =AVERAGE(B1:X1")
it will return the average where there are numbers and ignores nulls


"Murali G" wrote in message
...
Yes, it is easier to write a function as you suggested. But as i said the
data keeps increasing, instead of writing a formula every month it is
better
to write a macro which calculates the average every time by clicking a
button.

Please help.

Regards,
Murali. G

"Sam Wilson" wrote:

Is it not quicker to use =AVERAGE(A1:A20) in cell A21 etc than to write a
macro?


"Murali G" wrote:

Hello-

There is a requirement in my project to find the average of values in a
sheet. Values starts from A1 and goes till G20 (which keeps changing
every
month). For each row we have to find the Average.
For example;
A B C D
-- -- -- --
10 20 10 40
30 40 20 50
50 60 30 60

For Row 'A' we have to find the Average, similarly for 'B','C' and 'D'.

Instead of doing manually is there any code to perform this task by
writing
a macro.

Please let me know if you need any further details.

Regards,
Murali. G


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default To find Average

This will find the last ROW and delete it for the previous average. So,
first time put something in a last row to delete. Then if finds the longest
column on the page and puts the average of each column two cells below.

Sub findlastcellandaveragecolumns()
Rows(Cells(Rows.Count, 1).End(xlUp).Row).Delete
lr = Cells.Find(What:="*", After:=[A1], _
SearchDirection:=xlPrevious).Row

For i = 1 To _
Cells(1, Columns.Count).End(xlToLeft).Column
Cells(lr+2, i).Value = _
Application.Average(Cells(2, i).Resize(lr))
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...

There is no such thing as row A. There is row 1 and column A. Why not just
use the AVERAGE function.
What do you want to average and where do you want the number to be placed?
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Murali G" wrote in message
...
Hello-

There is a requirement in my project to find the average of values in a
sheet. Values starts from A1 and goes till G20 (which keeps changing
every
month). For each row we have to find the Average.
For example;
A B C D
-- -- -- --
10 20 10 40
30 40 20 50
50 60 30 60

For Row 'A' we have to find the Average, similarly for 'B','C' and 'D'.

Instead of doing manually is there any code to perform this task by
writing
a macro.

Please let me know if you need any further details.

Regards,
Murali. G



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
To find Average Rick Rothstein Excel Programming 0 June 11th 09 04:06 PM
To find Average Don Guillett Excel Programming 0 June 11th 09 03:33 PM
Find average Karthik Excel Discussion (Misc queries) 1 February 4th 09 05:43 AM
Need to find the Average Cindy Excel Worksheet Functions 7 March 5th 08 11:06 PM
Find monthly average but have average automatically configured kimbafred Excel Discussion (Misc queries) 2 August 8th 07 12:28 AM


All times are GMT +1. The time now is 07:48 AM.

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

About Us

"It's about Microsoft Excel"