我试图从低于平均值的一维数据范围中选择那些值。
这段代码对吗?我认为我如何将它们放入数组BelowAvg中存在问题......
Function MoyBelow(data As Range) As Variant
Dim i As Integer
Dim N As Long
Redim BelowAvg() As Variant
Dim Varian As Double
Dim Somcar() As Variant
N=WorksheetFunction.Count(data)
RendMoy=WorksheetFunction.Average(data)
For i=1 To N
If data.Cells(i).Value < RendMoy Then
BelowAvg(i).Value = data(i).Value
End If
NB = BelowAvg.Count
For j=1 To NB
SumSq= SumSq + (BelowAvg(i) - RendMoy)^2
Next j
Next i
Varian = SumSq/NB
End Function