Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Advanced use of WORKDAY function | Excel Worksheet Functions | |||
Advanced if function?? | Excel Worksheet Functions | |||
Advanced Function help | Excel Worksheet Functions | |||
Advanced IF function | Excel Worksheet Functions | |||
Error Handling #N/A with AVERAGE Function - Average of values in Row | Excel Worksheet Functions |