Function DDAvg(ParamArray A() As Variant) As Single
'示例:select *,DDAvg(字段1,字段2,字段3,字段4) as 平均值 from 表1
Dim i As Long
Dim S As Single
Dim C As Long
S = 0: C = 0
For i = 0 To UBound(A, 1)
If IsNumeric(A(i)) = True Then
S = S + A(i)
C = C + 1
End If
Next
If C <> 0 Then
DDAvg = S / C
Else
DDAvg = 0
End If
End Function