Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default advanced average function

try a simple for...next loop

Sub test()

Dim rw As Long, maxrow As Long
Dim Inc As Long ' offset for formula
Dim Col As String ' column for result

Inc = 10 ' used for our offset
Col = "C"
maxrow = Range("a1").End(xlDown).Row
For rw = 1 To maxrow / Inc
Cells(rw, Col).Formula = "=Average(A" & (rw - 1) * Inc
+ 1 & _
":A" & rw * Inc & ")"
Next

End Sub



Patrick Molloy
Microsoft Excel MVP




-----Original Message-----
Hello,
I have 3 columns of data and 60 rows. I want to

average 10 rows
at a time, eg avg(a1:a10) and next formulat will be from

avg(a11:a20),
etc. How do i auto increment the cells? when i copy the

formula the
average function increment by one only from avg(a1:a10)

to avg
(a2:a11). I want it to go from avg(a1:a10) to avg

(a11:a20).. Any
help? thanks.
.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default advanced average function

Patrick,

Thanks for all your help.


"Patrick Molloy" wrote in message ...
try a simple for...next loop

Sub test()

Dim rw As Long, maxrow As Long
Dim Inc As Long ' offset for formula
Dim Col As String ' column for result

Inc = 10 ' used for our offset
Col = "C"
maxrow = Range("a1").End(xlDown).Row
For rw = 1 To maxrow / Inc
Cells(rw, Col).Formula = "=Average(A" & (rw - 1) * Inc
+ 1 & _
":A" & rw * Inc & ")"
Next

End Sub



Patrick Molloy
Microsoft Excel MVP




-----Original Message-----
Hello,
I have 3 columns of data and 60 rows. I want to

average 10 rows
at a time, eg avg(a1:a10) and next formulat will be from

avg(a11:a20),
etc. How do i auto increment the cells? when i copy the

formula the
average function increment by one only from avg(a1:a10)

to avg
(a2:a11). I want it to go from avg(a1:a10) to avg

(a11:a20).. Any
help? thanks.
.

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
Advanced use of WORKDAY function sue Excel Worksheet Functions 4 September 30th 09 01:29 PM
Advanced if function?? 5tacey Excel Worksheet Functions 2 March 25th 09 05:39 PM
Advanced Function help akemeny Excel Worksheet Functions 5 October 9th 08 03:14 PM
Advanced IF function wrinkle35 Excel Worksheet Functions 2 September 28th 05 09:13 PM
Error Handling #N/A with AVERAGE Function - Average of values in Row Sam via OfficeKB.com Excel Worksheet Functions 13 July 31st 05 03:59 PM


All times are GMT +1. The time now is 11:10 AM.

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"