Solved

VBSCRIPT to match and merge data form 2 spreadsheets

Posted on 2010-11-09
4
426 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:aroina
  • 2
4 Comments
 
LVL 81

Expert Comment

by:byundt
ID: 34098240
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.
0
 
LVL 81

Expert Comment

by:byundt
ID: 34098256
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)
0
 

Accepted Solution

by:
keden earned 125 total points
ID: 34098765
You could incorporate error capturing to remove the #N/A's to pretty it up a bit.  Same as above...place the formula below in target sheet cell 2 and carry all the way down.  This particular example brings back the managers name where there is a match and leaves blank if no match is found.

=IF(ISERROR(VLOOKUP(B:B,source!B:E,4,FALSE))=TRUE,"",VLOOKUP(B:B,source!B:E,4,FALSE))

Rod
0
 

Author Comment

by:aroina
ID: 34102439
Rod... your solution works perfect for the manager field... can you do the same for the userid?
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question