look up and match

geno607

New Member
Joined
Apr 23, 2018
Messages
8
I'm trying to merge two reports together. One report gives the customer id and no customer name the other contains both. I have one report on sheet 1 the other on sheet 2. I need excel to match the customer id on sheet 1 to the customer id on sheet 2 then copy the customer name on sheet 2 to the proper customer id on sheet 1. Is that even possible? This is one report I need to build out of 7 so the amount of cells could vary. any ideas where to start? I can do a find / replace but that is taking way to long. Thank you in advance.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
this is your 2 reports


Book1
A
1ID
21
35
48
59
610
712
Sheet1



Book1
AB
1IDName
21N1
32N2
43N3
54N4
65N5
76N6
87N7
98N8
109N9
1110N10
Sheet2


copy Cell B2 down


Book1
AB
1ID
21N1
35N5
48N8
59N9
610N10
712No match
Sheet1
Cell Formulas
RangeFormula
B2=IFERROR(VLOOKUP(A2,Sheet2!A:B,2,FALSE),"No match")
 
Upvote 0
If you want a macro, how about
Code:
Sub getNames()
   Dim Cl As Range
   Dim Ws1 As Worksheet, Ws2 As Worksheet
   
   Set Ws1 = Sheets("sheet1")
   Set Ws2 = Sheets("sheet2")
   With CreateObject("scripting.dictionary")
      For Each Cl In Ws2.Range("A2", Ws2.Range("A" & Rows.Count).End(xlUp))
         .Item(Cl.Value) = Cl.Offset(, 1).Value
      Next Cl
      For Each Cl In Ws1.Range("A2", Ws1.Range("A" & Rows.Count).End(xlUp))
         Cl.Offset(, 1).Value = .Item(Cl.Value)
      Next Cl
   End With
End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,917
Members
449,093
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top