Solved

VBSCRIPT to match and merge data form 2 spreadsheets

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

622 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