View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
saziz[_57_] saziz[_57_] is offline
external usenet poster
 
Posts: 1
Default range average code


Hi Peter,
Thank you for your help. I did not have any blank cells in the range.
All I wanted was to average each block of 6 rows B2:C7. and put that
average (output) in col d7. David's code helped except I had to
slightly change the range.
thank you
Syed

Peter Beach Wrote:
Hi again saziz,

Just to be clear, if you copy the formula below straight down all cells
in
column B (in my example) you will have the effect I think you are after
of
showing the average of each block of six values interpersed with cells
that
appear blank. I presume the problem you are having is that it is
inconvenient to have to copy then paste every 6 cells down a column of
2,500
rows :-(

Regards,

Peter Beach

"Peter Beach" wrote in message
...
Hi saziz,

If you wanted a pure formula solution, try something like:

=IF(MOD(ROW(B1),6)=0,AVERAGE(OFFSET(A1,0,0,6,1))," ")

That will average the values in column A every 6 rows.

Just an idea.

Regards,

Peter Beach

"saziz" wrote

in
message ...

Hi Folks,
I have a sheet with data in col. B & C 2500 rows.
I do average on every 6th. row down until 2,500 rows.
I find myself doing this quite often. Wondering if someone can

help
me write a VBA code.

first range value is (B2:C7) and then next would be further 6 rows

down
starting from (B8:C13) until where the data ends (about 2500 rows)

Thank you for your help.
Syed


--
saziz

------------------------------------------------------------------------
saziz's Profile:

http://www.excelforum.com/member.php...fo&userid=6350
View this thread:

http://www.excelforum.com/showthread...hreadid=498143





--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=498143