|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参考
- Sub test()
- Dim Arr, Dic, i&, j&
- Set Dic = CreateObject("scripting.dictionary")
- Arr = [a1].CurrentRegion
- For i = 2 To UBound(Arr)
- If InStr(Arr(i, 3), ",") Then
- s = Arr(i, 2) / (UBound(Split(Arr(i, 3), ",")) + 1)
- For j = 0 To UBound(Split(Arr(i, 3), ","))
- Dic(Split(Arr(i, 3), ",")(j)) = Dic(Split(Arr(i, 3), ",")(j)) + s
- Next j
- Else
- Dic(Arr(i, 3)) = Dic(Arr(i, 3)) + Arr(i, 2)
- End If
- Next i
- [e2].Resize(Dic.Count, 2) = Application.Transpose(Array(Dic.keys, Dic.items))
- Set Dic = Nothing
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|