Link to home
Start Free TrialLog in
Avatar of aroina
aroina

asked on

VBSCRIPT to match and merge data form 2 spreadsheets

i ahve 2 speradsheets with informaiton and one identical field called "EmployeeID". need to use that field to get data from second spreaheet or second tab and populate the matching columns from sheet to sheet 1. or a formaula in excel will fdo as well.

attaching a sample file

sheet 1 is target that needs to be completed from sheet 2. this is just a sample, i have over 20K records to caompre and match. sheet 2 will have more records than sheet 1 but i only need to match up on EmployeeID to get data from sheet 2.
sample.xlsx
Avatar of byundt
byundt
Flag of United States of America image

Try the following formula in target cell C2:
=VLOOKUP($B2,source!$B:$Z,MATCH(target!C$1,source!$B$1:$Z$1,0),FALSE)

Note that the formula returns #N/A if either the column header label or the employee ID is not found. The former problem was caused in part by an extra space at the end of "manager " in Source cell E1.
The suggested formula assumed that the real lookup table occupies columns B through Z on worksheet source. The reference to $B$1:$Z$1 should be to the header labels in that lookup table. And since the formula is going on the target worksheet, I could have simplified it to:
=VLOOKUP($B2,source!$B:$Z,MATCH(C$1,source!$B$1:$Z$1,0),FALSE)
ASKER CERTIFIED SOLUTION
Avatar of keden
keden

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aroina
aroina

ASKER

Rod... your solution works perfect for the manager field... can you do the same for the userid?