With start# in B1, end# in B2, and AVG in B3:
Adjust the ranges to suit your placement
Sub MyAvg()
Dim StartRng As Range, EndRng As Range
Dim MyStr As String
MyStr = "B" & Range("B1").Value + 200
Set StartRng = Range(MyStr)
MyStr = "B" & Range("B2").Value + 200
Set EndRng = Range(MyStr)
Range("B3").Value = WorksheetFunction.Average(StartRng, EndRng)
End Sub
Mike F
"tbraddy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have some data that is listed in the lower portion of a worksheet
> (rows 201+) and want to grab it based on user input into a cell. I
> also want to calculate an average of that data.
>
> ie
> Value
> Start 30 lookup value for 30
> End 60 lookup value for 60
> Average calculate average for 30-60
>
> I could just do it =B230 =B260 =average(B230:B260), but having it
> update would be much easier
> I can do a lookup on the Start and End data, but the average is not
> as
> easy.
> Is there a way to say =B(200 + value of Start), =B(200+End),
> =average(B(200+start):B200+end))?
>
> Thanks Todd
>
|