ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel: how to merge data from 2 workbooks with 1 col. in common? (https://www.excelbanter.com/excel-discussion-misc-queries/32411-excel-how-merge-data-2-workbooks-1-col-common.html)

Cesare

Excel: how to merge data from 2 workbooks with 1 col. in common?
 
I've got two separate workbooks. Each workbook contains unique columns except
for one, which is a "key" column, or an id field.
Example: I have a client # column in both workbooks. In the first workbook,
I also have first name and last name columns. In the second column, I have
phone number and address columns. How do I merge the two workbooks into one
so that for each client # I have their first name, last name, phone number,
and address.

bigwheel

Well, I think I'd start by getting all the data into one workbook. With both
workbooks open, select the worksheet with the phone number and address then
click EditMove or Copy Sheet. Select the target book under 'To Book' and
select it's required destination under 'Before Sheet' Check the 'Create a
copy' checkbox then click OK

Once the data is all in one place you can copy the require columns to where
ever you want them



Fred

Use VLOOKUP

I assume second worksheet has ColA: ID #, ColB: Phone #, ColC: Address

Sort the second worksheet by ID number and name a range covering A1 to last
row in C as 'data'.

In the first worksheet D1 enter
=VLOOKUP(A1,Sheet2!data,2,false) - this will return the phone number if ID
is present.

In E1 enter
=VLOOKUP(A1,Sheet2!data,3,false) - this will retun the address if ID is
present.

Copy D1 and E1 down all rows - job done.

HTH

"Cesare" wrote:

I've got two separate workbooks. Each workbook contains unique columns except
for one, which is a "key" column, or an id field.
Example: I have a client # column in both workbooks. In the first workbook,
I also have first name and last name columns. In the second column, I have
phone number and address columns. How do I merge the two workbooks into one
so that for each client # I have their first name, last name, phone number,
and address.



All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com