视觉基础中阵列的非零平均值

时间:2017-01-18 19:12:31

标签: arrays vba average standard-deviation

我有一个包含2000个元素的数组,我想计算非零元素的平均值和标准差。 这是我的代码:

Function CI(Column_In As Integer, Row_Out As Integer, Column_Out As String)

Dim Arr() As Integer
N_of_P = 2000
ReDim Arr(N_of_P)

   For i = 3 To N_of_P
   Arr(i) = Worksheets(1).Cells(i, Column_In).Value
   Next i

   With Application.WorksheetFunction

   DAverage = .Averageif(Arr, "Arr <> "0") ' this causes the error!
   dStdDev = .StDev(Arr) ' do we have standard deviation if function?

   End With

0 个答案:

没有答案