Copying data between duplicated rows

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!!
 
O

Otto Moehrbach

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
 
C

cjg.groups

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top