Old thread but somehow I got entangled in this. 
This UDF seems to work if the latest 5 is either from left or right:
Option Explicit
Dim m As Integer, n As Integer, cd As Integer, k As Integer
Dim sum As Double
Function AverageLast(Rng As Range, LatestRight As Boolean, NoOfInAverage As Integer)
n = 0
m = 0
If LatestRight Then
cd = Rng.Cells.Count
k = 1
Else
cd = 1
k = -1
End If
While n < NoOfInAverage And m < Rng.Cells.Count And m >= -Rng.Cells.Count
If Len(Rng.Cells(cd - m).Value) > 0 Then
sum = sum + Rng.Cells(cd - m).Value
n = n + 1
End If
m = m + k
Wend
AverageLast = sum / NoOfInAverage
End Function
Bookmarks