Hi, everyone, i am new here.
Hope someone can solve my problem
here is the thing:
Column A B
Pig 20
Pig 3
Cow 10
Cow 3
what i wanted
Column A B
Pig 20
Cow 10
I tried unique filtering but it wont put in the column B if i am to unique filter the column A
Any help appreciated
Hi jungelbobo
something like
Sub ptest() Dim a, b(), i!, n! With Range("a1", Range("a" & Rows.Count).End(xlUp)).Resize(, 2) a = .Value End With ReDim b(1 To UBound(a, 1), 1 To 2) With CreateObject("Scripting.Dictionary") .CompareMode = vbTextCompare For i = 1 To UBound(a, 1) If Not IsEmpty(a(i, 1)) Then If Not .exists(a(i, 1)) Then n = n + 1 b(n, 1) = a(i, 1) .Add a(i, 1), n End If b(.Item(a(i, 1)), 2) = b(.Item(a(i, 1)), 2) + a(i, 2) End If Next End With Range("D1").Resize(n, 2).Value = b End Sub
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks