当前位置: 首页 > >

Excel 加权*均计算宏

发布时间:

Function WeightedAverage(Weight As Range, Value As Range)

'加权*均计算。Weight-权;value-值 '∑权, 如∑样长、 ∑矿石量

sWeight = Application.WorksheetFunction.Sum(Weight) sWeightValue = Application.WorksheetFunction.SumProduct(Weight, Value)

'∑(权×值),∑(样长×MFe)、∑(矿石量×MFe) WeightedAverage = Round(sWeightValue / sWeight, 2) '*均值,如 MFe,保留 2 位小数

End Function




友情链接: