Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help?? Averaging cells
Okay, I'm stumped here.
I want to be able to write a macro that will go down a list of cells, and if the offset(0,-1) is blank, then will execute code. That part I've written. But what I need it to do is fill any blank cells to the left with the average of the first cell and the next cell with data. Ie Row 365 has a value of 9 in column E. There are blank cells in column D & C, and in column B there is a value of 3. I want the macro to work out the average of 3 and 9, and put the answer, 6, in cells C365 & D365. The number of gaps between cells will vary, so I was wanting to use a xlToLeft, but how can I get it to work out the averages of the two cells with values in them? Thanks Paul --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help?? Averaging cells
for each cell in Range(whatever) num = Application.Average(Cell, cell.End(xlToLeft)) for col = cell.End(xltoLeft).Column + 1 to cell.Column - 1 then cells(cell.row,col) = num Next Next -- Regards, Tom Ogilvy "PaulSinki" wrote in message ... Okay, I'm stumped here. I want to be able to write a macro that will go down a list of cells, and if the offset(0,-1) is blank, then will execute code. That part I've written. But what I need it to do is fill any blank cells to the left with the average of the first cell and the next cell with data. Ie Row 365 has a value of 9 in column E. There are blank cells in column D & C, and in column B there is a value of 3. I want the macro to work out the average of 3 and 9, and put the answer, 6, in cells C365 & D365. The number of gaps between cells will vary, so I was wanting to use a xlToLeft, but how can I get it to work out the averages of the two cells with values in them? Thanks Paul --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Averaging with #N/A Cells | Excel Discussion (Misc queries) | |||
averaging cells | Excel Discussion (Misc queries) | |||
Averaging Cells Based On Conditions in Neighboring Cells | Excel Discussion (Misc queries) | |||
Averaging Cells | Excel Discussion (Misc queries) | |||
Averaging cells which contain #DIV/0! | Excel Worksheet Functions |