Foxtable(狐表)用户栏目专家坐堂 → 请问如何实现去除最高、最低,次高、次低*0.5计算


  共有2564人关注过本帖树形打印复制链接

主题:请问如何实现去除最高、最低,次高、次低*0.5计算

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/16 14:18:00 [显示全部帖子]

Dim A As String = "1,2,3,4,5,6,7"
Dim ary() As String = A.Split(",")
Dim nary(ary.Length-1) As Integer

Dim sum As Double = 0
For i As Integer = 0 To nary.length - 1
    sum += val(ary(i))
    nary(i) = ary(i)
Next

array.sort(nary)

Dim B As Double
If ary.Length <= 7 Then
    B = (sum-nary(nary.length-1)-nary(0)) / (nary.length-2)
Else
    B = (sum-nary(nary.length-1)-nary(0)+nary(nary.length-2)*0.5+nary(1)*0.5) / (nary.length-3)
End If

msgbox(B)


 回到顶部