ExcelでカスタムVBA関数の実行(引数としてセルの範囲を受け取る)

ここを参考に。
stackoverflow.com

Function myAverage(r As Range)

    Dim cell As Range, total As Double, count As Integer
    For Each cell In r
        total = total + cell.Value
        count = count + 1
    Next cell
    myAverage = total / count

End Function

実行の仕方
youtu.be