I would like to take an average of the cell every 7 cells. For example, I want to take the average of Cell A1, A8, A15, A22 etc. Then another average of A2, A9, A16, A23 etc. How can I do this quickly as I have a large data set.
Thanks
Maybe a user defined function
Public Function Get7Average(ByVal rng As Range) As Variant
Dim arr(), i, total As Long, counter As Long
If rng.Columns.Count > 1 Or rng.Cells.Count < 7 Then
Get7Average = CVErr(xlErrNA)
Exit Function
Else
arr = rng.Value
For i = LBound(arr, 1) To UBound(arr, 1) Step 7
counter = counter + 1
If IsNumeric(arr(i, 1)) Then
total = total + arr(i, 1)
End If
Next
End If
If total = 0 Then
Get7Average = CVErr(xlErrNA)
Exit Function
End If
Get7Average = total / counter
End Function
In sheet