其中 data 指定为对应的单元格, Ran选择全部的源数据(需要使用绝对引用,这样可以方便复制公式) Del是你要去出的数据个数,如 2 表示去掉2个最高和2个最低。
Function ExTRIMMEAN(data A360问答s Single, Ran As Range, Del As Integer) Dim ZMAX As Integer, ZMIN As Integer Dim ZRAN As Range
ZMAX = 0 ZMIN = 0 For Each ZRAN In Ran
If data ZRAN.Value Then ZMIN = ZMIN + 1 If data ZRAN.Value Then ZMAX = ZMAX + 1 Next ExTRIMMEAN = data If ZMAX Del Or ZMIN Del Then ExTRIMMEAN = "" End Function
其中 data 指定为对应的单元格, Ran选择全部的源数据(需要使用绝对引用,这样可以方便复制公式) Del是你要去出的数据个数,如 2 表示去掉2个最高和2个最低。
Function ExTRIMMEAN(data As Single, Ran As Range, Del As Integer) Dim ZMAX As Integer, ZMIN As Integer Dim ZRAN As Range
ZMAX = 0 ZMIN = 0 For Each ZRAN In Ran
If data ZRAN.Value Then ZMIN = ZMIN + 1 If data ZRAN.Value Then ZMAX = ZMAX + 1 Next ExTRIMMEAN = data If ZMAX Del Or ZMIN Del Then ExTRIMMEAN = End Function