班级
|
姓名
|
语文
|
数学
|
英语
|
语数英
|
物理
|
化学
|
生物
|
物化生
|
语数英物化生
|
分数
|
级名
|
班名
|
分数
|
级名
|
班名
|
分数
|
级名
|
班名
|
小计
|
级名
|
班名
|
分数
|
级名
|
班名
|
分数
|
级名
|
班名
|
分数
|
级名
|
班名
|
小计
|
级名
|
班名
|
总分数
|
级名
|
班名
|
1
|
宗
|
150
|
9
|
3
|
145
|
9
|
3
|
148
|
9
|
3
|
443
|
9
|
3
|
89
|
9
|
3
|
100
|
9
|
3
|
99
|
9
|
3
|
288
|
9
|
3
|
731
|
9
|
3
|
1
|
需
|
146
|
8
|
2
|
138
|
8
|
2
|
128
|
8
|
2
|
412
|
8
|
2
|
90
|
8
|
2
|
98
|
8
|
2
|
98.5
|
8
|
2
|
286.5
|
8
|
2
|
698.5
|
8
|
2
|
2
|
杨
|
145
|
5
|
2
|
148
|
5
|
2
|
135.5
|
5
|
2
|
405.5
|
5
|
2
|
95
|
5
|
2
|
99.5
|
5
|
2
|
90
|
5
|
2
|
284.5
|
5
|
2
|
690
|
5
|
2
|
2
|
李
|
140
|
4
|
1
|
119.5
|
4
|
1
|
132
|
4
|
1
|
391.5
|
4
|
1
|
89
|
4
|
1
|
78
|
4
|
1
|
98
|
4
|
1
|
265
|
4
|
1
|
656.5
|
4
|
1
|
3
|
张
|
138
|
6
|
4
|
128
|
6
|
4
|
119
|
6
|
4
|
385
|
6
|
4
|
79
|
6
|
4
|
88
|
6
|
4
|
98
|
6
|
4
|
265
|
6
|
4
|
650
|
6
|
4
|
3
|
安
|
145
|
7
|
3
|
132
|
7
|
3
|
129
|
7
|
3
|
396
|
7
|
3
|
99.5
|
7
|
3
|
82
|
7
|
3
|
90
|
7
|
3
|
271.5
|
7
|
3
|
667.5
|
7
|
3
|
3
|
库
|
130
|
3
|
2
|
108
|
3
|
2
|
148
|
3
|
2
|
386
|
3
|
2
|
100
|
3
|
2
|
100
|
3
|
2
|
99
|
3
|
2
|
299
|
3
|
2
|
685
|
3
|
2
|
3
|
王
|
125
|
2
|
1
|
|
2
|
1
|
|
2
|
1
|
125
|
2
|
1
|
|
2
|
1
|
|
2
|
1
|
|
2
|
1
|
0
|
2
|
1
|
125
|
2
|
1
|
1
|
孔
|
146
|
1
|
1
|
|
1
|
1
|
|
1
|
1
|
126
|
1
|
1
|
|
1
|
1
|
|
1
|
1
|
|
1
|
1
|
0
|
1
|
1
|
126
|
1
|
1
|
老师:您好!
For Each dr As DataRow In DataTables("学生成绩统计表").DataRows
dr("语数英_小计")=dr("语文_分数")+dr("数学_分数")+dr("英语_分数")
dr("物化生_小计")=dr("物理_分数")+dr("化学_分数")+dr("生物_分数")
dr("语数英物化生_总分数")=dr("语文_分数")+dr("数学_分数")+dr("英语_分数")+dr("物理_分数")+dr("化学_分数")+dr("生物_分数")
Next
Dim drs As List(of DataRow) =
DataTables("学生成绩统计表").Select("班级 is not null","语数英物化生_总分数")
For i As Integer = 0 To
drs.Count - 1
drs(i)("语文_级名") = i + 1
Next
For i As Integer = 0 To
drs.Count - 1
drs(i)("数学_级名") = i + 1
Next
For i As Integer = 0 To
drs.Count - 1
drs(i)("英语_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("语数英_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("物理_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("化学_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("生物_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("物化生_级名") = i + 1
Next
For i As Integer = 0 To drs.Count
- 1
drs(i)("语数英物化生_级名") = i + 1
Next
Dim lst As List(of String ) =
DataTables("学生成绩统计表").GetValues("班级","班级 is not
null")
For Each s As String In lst
drs =
DataTables("学生成绩统计表").Select("班级='" & s & "'","语文_分数")
For i As
Integer = 0 To drs.Count - 1
drs(i)("语文_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("数学_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("英语_班名") = + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("语数英_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("物理_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("化学_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("生物_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("物化生_班名") = i + 1
Next
Next
For Each s As String In lst
For i As
Integer = 0 To drs.Count - 1
drs(i)("语数英物化生_班名") = i + 1
Next
Next
老师:您好!上述代码不能实现以下要求。请老师修改一下。谢谢!!!
1、共9个同学在不同的3个班,如何用代码来实现每个同学各科_分数、语数英_小计、语数英物化生_总分数的班级排名、年级排名?如年级排名第一名为在“级名”列显示“1” 、班级排名第二名为“2”在“班名”名列显示“2”? 如表所示的成绩,一班的“宗”同学:“语文”是年级排名第一名,如何在“级名”列显示为“1”? 班级排名第一名,如何在“班名”列显示为“1”?“数学”是年级排名第二名,如何在“级名”列显示为“2”? 班级排名第一名,如何在“班名”列显示为“1”?即各科_分数、语数英_小计、语数英物化生_总分数的班级排名、年级排名是随各科分数变化而变化,而不应该是用某一科成绩的班级排名、年级排名作为所有学科成绩的班级排名、年级排名。
2、二班的“杨”同学语文成绩是年级排名第三名,如何在“级名”列显示为“3”? 班级排名第一名,如何在“班名”列显示为“1”? 三班的“安”同学语文成绩是年级排名并列第3名,如何在“级名”列显示为“3”? 班级排名第二名,如何在“班名”列显示为“2”? 一班的“孔”同学语文成绩是年级排名并列第二名,如何在“级名”列显示为“2”? 班级排名并列第二名,如何在“班名”列显示为“2”? 即各科_分数、语数英_小计、语数英物化生_总分数的班级排名、年级排名若出现并列排名情况时,是否可以用代码实现如“本第二条”所述?
3、当某一科成绩清除时,班名列、级名列如何显示为清空状态?
我的版本是2021.4.5前版本