Solved

VBSCRIPT to match and merge data form 2 spreadsheets

Posted on 2010-11-09
4
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

734 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