Function KERNELDIST(x As Single, h As Single, y As Range) As Single 'Declaration of variables Dim z As Single Dim n As Integer 'Initializing of variables KERNELDIST = Empty For n = 1 To y.Count z = TRIWEIGHT((x - y.Cells(n, 1)) / h) KERNELDIST = KERNELDIST + z Next '--------------------------------------------------------------------------- -------------------- KERNELDIST = KERNELDIST / (y.Count * h) End Function Function TRIWEIGHT(x) If x >= -1 And x <= 1 Then TRIWEIGHT = 35 / 32 * (1 - x ^ 2) ^ 3 Else TRIWEIGHT = 0 End If End Function