Dim fhs() As String = {"德","能","勤","绩","廉"}
Dim pj2s() As String = {"好","较好","一般","差"}
Dim djs() As String = {"A","B","C","D"}
Dim dlqjs() As String = {"题号1","题号2","题号3","题号4","题号5"}
For Each fh As String In fhs
For Each dlqj As String In dlqjs
For i As Integer = 1 To 5
For j As Integer = 0 To djs.length - 1
dr("德" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号1") &")", "" & dr("题号1") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
dr("能" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号2") &")", "" & dr("题号2") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
dr("勤" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号3") &")", "" & dr("题号3") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
dr("绩" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号4") &")", "" & dr("题号4") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
dr("廉" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号5") &")", "" & dr("题号5") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
Next
Next
Next
Next
红色代码简化成:
dr(fh & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr(dlqjs(j)) &")", "" & dr(dlqjs(j)) & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")
统计结果全是最后一个红色代码dr("廉" & djs(j) & "人") = DataTables("答案1").Compute("Count("& dr("题号5") &")", "" & dr("题号5") & " = '"& djs(j) &"' And [单位] = '" & dr("单位") & "'")的结果。
此主题相关图片如下:统计结果.png
不知问题在哪,如何修改代码?请指教,谢谢!
[此贴子已经被作者于2021/2/20 14:27:03编辑过]