Merge two spreadsheets (files) based on ID

simplicityq88

New Member
Joined
Mar 21, 2011
Messages
11
Hello there Excel fans and lovers.

I'm a long time excel user and I've come up with an issue, it can surely be solved in any other larger database language but excel is just my everyday friend and I was wondering if it's possible to do such a thing.

I've been googeling for a while and no good results.

This is the problem:

I have a list of "people" in my 1st ssheet and they have

ID | ProductName| Category | Year |

and I have this data on the 2nd ssheet

ID | Price | Description

---------------------------------------------------------

There is 600.000 records in the primary sheet but only 22.000 in the secondary because the data doesn't repeat (one description can fit to 10.000 products, no need to write it down that much times).

But now I need to compile one big/large file, so I need to have one file that contains all:

ID | ProductName| Category | Year | + | Price | Description


In MS SQL I would use the "Where" function and compare the ID here and there, but is there a possible way to do it in excel?

Thank you in advance!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

A vlookup would do the job....assuming your layouts are pretty much the same as below, tweak the formulas to cover your range then drag them down to copy them:

Excel Workbook
ABCDEF
1IDProduct NameCatYearPriceYear
21CarBlah1999$20Red
31CarBlah1999$20Red
41CarBlah1999$20Red
52BusBlah1999$40Blue
62BusBlah1999$40Blue
72BusBlah1999$40Blue
Sheet1



And second file with the 22K entries

Excel Workbook
ABC
1IDPriceDescription
21$20Red
32$40Blue
Sheet1



HTH
Ian
 
Upvote 0
Ian, this is awesome, I believe it did the job.

Thank you very much for a "uber"fast response.



Kind regards,
J.
 
Last edited:
Upvote 0
Hi,

I am also trying to do something very simlar, and I believe what you suggested should work for me, but I was wondering if it could be elaborated a bit more in a 'excel for dummies' format.

Thanks
 
Upvote 0
Hi Aviavy,

Let me try to explain.

Vlookup goes through all rows in a given array and searches for your criteria.
In this case "A2" is the criteria.
Then after the comma goes the array where to look up.
After the array you specify what column are you adding (id) to the field where the formula is.

And at the end 0 or "false" to specify that is has to be an exact match.

Hope it's clear. If you test it around a little bit you'll have it working fine in any scenario.
 
Upvote 0
Hi Aviavy,

Let me try to explain.

Vlookup goes through all rows in a given array and searches for your criteria.
In this case "A2" is the criteria.
Then after the comma goes the array where to look up.
After the array you specify what column are you adding (id) to the field where the formula is.

And at the end 0 or "false" to specify that is has to be an exact match.

Hope it's clear. If you test it around a little bit you'll have it working fine in any scenario.


Pure awesomeness! I totally get it now! Played around with it like you suggested and everything totally works!
Thank you so much!
 
Upvote 0
Everything is still working fine, but I need to extend on this a bit now.

As it is right now, if the values match, then it copies the data from the second table. If it doesn't, it gives a value of #N/A. This alright with text columns, is creating havoc for a numerical column with the numbers that I need to sum.

Is there a way to either change VLOOKUP so that if there isn't a value it's blank or show 0?

Or is there a formula that I can use that can sum all numbers in a column filled with numbers and text?
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top