Donna,
The easiest way to handle this is with a User Defined Function (UDF). The
following will work for you.
Function AvgFirstFiveVals(ParamArray args() As Variant) As Double
'11th March 2010
'Author: Peter Atherton
Application.Volatile
Dim i As Variant, _
tmpRange As Range, _
cell As Range, _
tmpSum As Double, _
tmpCount As Integer, _
iLim As Integer
iLim = 5
For i = 0 To UBound(args)
If Not IsMissing(args(i)) Then
Set tmpRange = Intersect(args(i).Parent.UsedRange, args(i))
For Each cell In tmpRange
If IsNumeric(cell) And cell <> 0 And _
Len(cell) <> 0 Then
tmpCount = tmpCount + 1
tmpSum = tmpSum + cell
AvgFirstFiveVals = tmpSum / tmpCount
If tmpCount = iLim Then Exit Function
End If
Next cell
End If
Next i
End Function
This has to be copied in to the Visual basic Editor before it can be used.
Press ALT + F11, Insert, Module then paste the code in the Module. Press ALT
+ Q to quit the VBE and return to the spreadsheet.
Enter the function as you would for a SUM e.g.
=AVGFIRSTFIVEVALS(A1,C34,Sheet2!A67...Sheet3!B34:B40)
You can also link it to another workbook if you like.
HTH
Peter