|
楼主 |
发表于 2012-10-16 21:48
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
383579022 发表于 2012-10-16 21:46
VBA肯定能解决,用公式的话,估计......
Dim arr, brr, d As Object, i&, j&, k&, x$
Set d = CreateObject("scripting.dictionary")
arr = Range("a1").CurrentRegion
Range("a2:q" & UBound(arr)).ClearContents
For i = 2 To UBound(arr)
x = arr(i, 1) & "," & arr(i, 5) & "," & arr(i, 9) & "," & arr(i, 10) & "," & arr(i, 14)
d(x) = d(x) & "," & arr(i, 7)
Next
ReDim brr(1 To d.Count, 1 To UBound(arr, 2))
a = d.keys: b = d.items
For j = 0 To d.Count - 1
m = Split(b(j), ",")
For i = 2 To UBound(arr)
x = arr(i, 1) & "," & arr(i, 5) & "," & arr(i, 9) & "," & arr(i, 10) & "," & arr(i, 14)
If a(j) = x Then
For k = 1 To UBound(arr, 2)
brr(j + 1, k) = arr(i, k)
Next
brr(j + 1, 7) = IIf(m(0) = "", m(1), m(0))
brr(j + 1, 6) = Right(brr(j + 1, 7), 2)
brr(j + 1, 8) = m(UBound(m))
End If
Next
Next
Range("a2").Resize(UBound(brr), UBound(brr, 2)) = brr
高手,这是另一位高手写的东西,我也看不懂,你看看是VBA吗
|
|