计算工资大于2500的平均值

大神:

1 Sub 大于等于2500的平增工资()
2 Dim rs%, rng%, lj&, k%
3 For rs = 1 To 60
4     Range("b2:c20")(rs).Select
5      rng = Range("b2:c20")(rs)
6     If rng >= 2500 Then lj = lj + rng: k = k + 1
7 Next rs
8     MsgBox "大于等于2500的平均分为:" & Int(lj / k)
9 End Sub

我的:

 1 Sub 判断大小并取平均值()
 2 Dim i%, m%, n!, rg As Range, k
 3 For Each rg In Range("a1", "f11")
 4 m = rg.Value
 5 rg.Select
 6 If m >= 2500 Then n = n + m: i = i + 1
 7 Next
 8 k = n / i
 9 MsgBox "大于2500的平均工资是:" & k
10 End Sub

 

posted on 2018-02-08 17:20  搞笑机械师  阅读(284)  评论(0编辑  收藏  举报

导航