Solved

VBSCRIPT to match and merge data form 2 spreadsheets

Posted on 2010-11-09
4
425 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now