Copying data between duplicated rows

  • Thread starter Thread starter cjg.groups
  • Start date Start date
C

cjg.groups

Hello, how can I copy data between rows duplicated in two lists, but
not the data which is actually duplicated? Phew, that's tough to
summarize.

I have two lists, and both have two columns: name and data. The names
are mostly duplicate in both lists. I would like to copy the data
field from the old list to the new list, matching it up with the
proper names.

I've tried Chip Pearson's COUNTIF tricks, AutoFilter and sorting, but
I can't seem to find a solution. Any suggestions? Thanks!!
 
The following little macro will do it for you. As written, this macro
assumes your new list is in Columns A:B with the names in A and the data in
B. Also, your old list is in Columns E:F with names in E and data in F.
Column C is the destination column and is blank. Come back if you need
more. HTH Otto
Sub OldToNew()
Dim rOldNames As Range
Dim rNewNames As Range
Dim i As Range
Set rNewNames = Range("A3", Range("A" & Rows.Count).End(xlUp))
Set rOldNames = Range("E3", Range("E" & Rows.Count).End(xlUp))
For Each i In rOldNames
If Not rNewNames.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
Then
rNewNames.Find(What:=i.Value, LookAt:=xlWhole).Offset(,
2).Value = _
i.Offset(, 1).Value
End If
Next i
End Sub
 
The following little macro will do it for you. As written, this macro
assumes your new list is in Columns A:B with the names in A and the data in
B. Also, your old list is in Columns E:F with names in E and data in F.
Column C is the destination column and is blank. Come back if you need
more. HTH Otto
Sub OldToNew()
Dim rOldNames As Range
Dim rNewNames As Range
Dim i As Range
Set rNewNames = Range("A3", Range("A" & Rows.Count).End(xlUp))
Set rOldNames = Range("E3", Range("E" & Rows.Count).End(xlUp))
For Each i In rOldNames
If Not rNewNames.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
Then
rNewNames.Find(What:=i.Value, LookAt:=xlWhole).Offset(,
2).Value = _
i.Offset(, 1).Value
End If
Next i

Thanks!! Using .Offset() was my last resort, but it seems simple
enough. But when I started considering VLOOKUP, I knew I was in too
deep. I will try this out, thanks again.
 
Back
Top