View Single Post
  #3   Report Post  
Don Guillett
 
Posts: n/a
Default

Sub Average3cellsOffset()
x = Cells(Rows.Count, "b").End(xlUp).row
y = Application.Average(Range("b" & x - 2).Resize(3, 1).Offset(0, 1))
MsgBox y
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try this idea

Sub last3cells()
x = Cells(Rows.Count, "b").End(xlUp).row
Range("b" & x - 2).Resize(3, 1).Select
End Sub

--
Don Guillett
SalesAid Software

"Still Learning" <Still
wrote in

message
...
I am trying calculate a rolling three month average as each months

numbers
are added. For example: If I have values for all the months up to July,

I
want to average May, June and July. When August is added I want it to
average June, July and August. I have been doing this by changing the

range
in the formula each month, but would like to make it more efficient and

user
friendly.
Thanks!