|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下:
Sub test()
arr = Sheets("原数1").[a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
Set dhz = CreateObject("scripting.dictionary")
brr = Sheets("统计数2").Range("A2:A" & Sheets("统计数2").[A2].End(xlDown).Row)
For i = 1 To UBound(brr)
d.RemoveAll
crr = Split(brr(i, 1), ",")
For c = 0 To UBound(crr)
d(crr(c)) = 0
Next
For m = 2 To UBound(arr)
drr = Split(arr(m, 1), ",")
gs = 0
For t = 0 To UBound(drr)
If d.exists(drr(t)) Then gs = gs + 1
Next
If Not dhz.exists(i) Then Set dhz(i) = CreateObject("scripting.dictionary")
dhz(i)(gs) = dhz(i)(gs) + 1
Next
Next
ReDim grr(1 To UBound(brr), 1 To UBound(crr) + 1)
For Each Key In dhz.keys
For Each gs In dhz(Key)
grr(Key, gs) = dhz(Key)(gs)
Next
Next
Sheets("统计数2").[b2].Resize(UBound(grr), UBound(grr, 2)) = grr
Set d = Nothing
Set dhz = Nothing
End Sub |
评分
-
1
查看全部评分
-
|