excel表格内,第一列有重复项,怎样删除第一列重复项,并且使第二列与对应的值加和,其余删除掉,谢谢

已解决,谢谢

第1个回答  2012-03-20
Set D = CreateObject("Scripting.Dictionary")
n = Cells(65536, 1).End(3).Row
Set rng = Cells(n + 1, 1)
For i = n To 1 Step -1
If Application.CountIf(Range("A:A"), Cells(i, 1)) > 1 Then
Set rng = Union(rng, Cells(i, 1))
D(Cells(i, 1).Value) = D(Cells(i, 1).Value) + Cells(i, 2)
Cells(i, 1) = "aaaaa"
Else
Cells(i, 2) = D(Cells(i, 1).Value) + Cells(i, 2)
End If
Next
rng.EntireRow.Delete
Application.ScreenUpdating = True
End Sub
第2个回答  2012-03-20
在B1输入公式=IF(COUNTIF(A$1:A1,A1)>1,"重复",""),下拉。
第3个回答  2012-03-20
把表发来 541042768本回答被提问者采纳
相似回答