Hi,
I love excell but am struggling with a macro. I hope someone can help.
I am trying to create a macro that will take the values of columnB, count the duplicates then display the values in columnE with the total number of value duplicates in ColumnF
I sourced this code which does something like I want but I cant split the Value B data(Code is A) into separate columns. I might be over thinking it. Code below.
Sub Summary()
'
'
Dim rngData As Range
Dim rngUniqueData As Range
Dim lngRow As Long
Dim lngCount As Long
'
Set rngData = Range("A1", Range("A1").End(xlDown))
rngData.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=rngData.Cells(1, 1).Offset(0, 1), Unique:=True
Set rngUniqueData = Range("B1", Range("B1").End(xlDown))
With rngUniqueData
For lngRow = 2 To .Rows.Count
lngCount = Application.WorksheetFunction.CountIf(rngData, .Cells(lngRow, 1).Value)
.Cells(lngRow, 1).Value = .Cells(lngRow, 1).Value & " - " & lngCount & IIf(lngCount > 1, " copies", " copy")
Next
End With
End Sub
Bookmarks