|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
优生统计代码
- Sub test3()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Worksheets("起点优生统计表")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(3, .Columns.Count).End(xlToLeft).Column
- .Range("d4").Resize(r - 3, c - 3).ClearContents
- brr = .Range("a4").Resize(r - 3, c)
- For i = 1 To UBound(brr)
- xm = brr(i, 1) & "+" & brr(i, 2) & "+" & brr(i, 3)
- d(xm) = i
- Next
- End With
- With Worksheets("起点成绩")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:q" & r)
- End With
- For i = 1 To UBound(arr)
- xm = arr(i, 1) & "+" & arr(i, 2) & "+" & arr(i, 3)
- If d.exists(xm) Then
- m = d(xm)
- For j = 10 To 13
- If j = 13 Then
- n = 4
- Else
- n = j * 6 - 50
- End If
- If Len(arr(i, j)) <> 0 Then
- If arr(i, j) <= 50 Then
- brr(m, n + 1) = brr(m, n + 1) + 1
- ElseIf arr(i, j) <= 100 Then
- brr(m, n + 2) = brr(m, n + 2) + 1
- End If
- If arr(i, j) <= 100 Then
- brr(m, n + 3) = brr(m, n + 3) + 1
- End If
- If arr(i, j) >= 151 And arr(i, j) <= 200 Then
- brr(m, n + 4) = brr(m, n + 4) + 1
- End If
- If arr(i, j) >= 101 And arr(i, j) <= 200 Then
- brr(m, n + 5) = brr(m, n + 5) + 1
- End If
- End If
- Next
- End If
- Next
- With Worksheets("起点优生统计表")
- .Range("a4").Resize(UBound(brr), UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|