Excel函数AVEDEV 单元格中计算为(绝对偏差)
但是狐表中没有这个函数调用,如何实现,目前本人只能用ABS来分步计算。但效果不佳
此主题相关图片如下:avedev.png

本人代码为:
For i As Integer = 0 To dt.rows.count -1
If i >= (x-1)
dt1.Rows(i)(TYP_MA) = Tables("01 CCI_计算表_Table1").Compute("Avg(TYP)","序号 >= " & i-x+1 & " And 序号 <= " & i)
End If
Next
For i As Integer = 0 To dt.rows.count -1
If i >= (x-1)
dt1.Rows(i)("ABS") = Math.Abs(dt1.Rows(i)("TYP") - dt1.Rows(i)("TYP_MA"))
Else
dt1.Rows(i)("ABS") = Math.Abs(dt1.Rows(i)("TYP") - dt1.Rows(x-1)("TYP_MA"))
End If
Next
For i As Integer = 0 To dt.rows.count -1
If i >= (x-1)
dt1.Rows(i)("TYP_AVEDEV") = Tables("01 CCI_计算表_Table1").Compute("Avg(ABS)","序号 >= " & i-x+1 & " And 序号 <= " & i)
End If
Next
[此贴子已经被作者于2021/3/13 0:01:03编辑过]