Combine tables

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

Could you please check if you can help me with the following:

I have two tables Table1 "Part Number" and Table2 "Manufacturer Part Number".

Table1 has following columns:
PartNumber, Manufacturer Name, ManufacturerP/N

Table2 has following columns:
ManufacturerP/N, Manufacturer Name, Description Lifecycle

As you may notice 'ManufacturerP/N' is common field between the two tables. I need to combine them into one table based on the ManufacturerP/N so that the result table appears like the following:

PartNumber,Manufacturer Name, ManufacturerP/N, Description, Lifecycle

Each part number can have more than one ManufacturerP/N associated with it and a manufacturerP/N can be associated to more than one PartNumbers.

Due to some IT restriction I am not able to download html maker at work. So I am trying to describe table structures as clearly as possible.

Thanks
Rajesh
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
You mention that each part number can have more than one ManufacturerP/N associated with it. If the PartNumbers that have multiple ManufacturerP/Ns are listed on multiple rows, as opposed to having multiple ManufacturerP/Ns in the column, then you could add two columns to the first table and use VLOOKUP.

=VLOOKUP(Reference to ManufacturerP/N, Table2, 2, 0) <-- Would return column 2 where it could match ManufacturerP/N, i.e. Manufacturer Name
=VLOOKUP(Reference to ManufacturerP/N, Table2, 3, 0) <-- Description Lifecycle
 
Upvote 0
Hello Reaperx

Thanks for your reply. In this case I am looking for VBA code because I am preparing a template and further data analysis will follow this merging the tables. I have prepared code for that analysis already.

The problem with VLOOKUP in this case is that it always returns the first match. So if I am looking up a manufacturer part number and trying to return P/N I will keep getting the P/N that is appearing first in the list.

Thanks
Rajesh
 
Upvote 0
With VBA it would be pretty easy, just add all of the items to a multidimensional array. Otherwise you could do it the long method and have a for loop run each time you do a search.
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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