三.平均分
Sub 平均分()
Const studentno = 190
Const xknum = 6
Dim fs(studentno, xknum), pjf3(4, 6), bjrs(4), qxpjf(6)
Dim bj(studentno)
Sheets("高三理").Select
'以下程序段用于求全校平均分
For i = 1 To studentno
bj(i) = ActiveSheet.Cells(i + 1, 1)
For j = 1 To xknum
fs(i, j) = ActiveSheet.Cells(i + 1, j + 3)
Next j
Next i
For i = 1 To xknum
Sum = 0
For j = 1 To studentno
um = Sum + fs(j, i)
Next j
qxpjf(i) = Sum / (j - 1)
Next i
'以下程序段用于求各班平均分
For j = 1 To 4
For i = 1 To studentno
Ifbj(i) = j + 2 Then
bjrs(j) = bjrs(j) + 1
For k = 1 To xknum
pjf3(j, k) = pjf3(j, k) + fs(i, k)
Next k
End If
Next i
Next j
For j = 1 To 4
For i = 1 To 6
pjf3(j, i) = pjf3(j, i) / bjrs(j)
Next i
Next j
'写入各班各科平均分
Sheets("平均分").Select
For i = 1 To 4
For j = 1 To 6
ActiveSheet.Cells(i + 2, j + 1) = pjf3(i, j)
Next j
Next i
'写入全校各科平均分
i = 7
For j = 1 To 6
ActiveSheet.Cells(i, j + 1) = qxpjf(j)
Next j
End Sub
推荐阅读
- excel-rows-函数解释分析科普大全
- Excel表格输入大量数字或身份证号码显示异常解决方法收获很多的
- Excel文件忘记密码了该怎么办帮助升级的技巧
- Excel函数-Lookup与Vlookup函数的区别及应用讲解[多图]
- 使用-Excel-数据透视表查看数据您要知道知识
- Excel-二级下拉菜单的3种方法高手进阶
- Excel表格中如何批量取消超链接图文攻略666
- Excel-跳过空单元实例两则速来看看
- 多种Excel表格条件自动求和公式欢迎阅读
- Excel常用函数扫盲知道的都在这里了