Transferring data from one workbook to another, if specific attribute matches

khelza

New Member
Joined
Feb 10, 2015
Messages
23
I don't have a very extensive background with excel, and no background with macros, but I have the feeling I will need to use a Macro to carry out the task in question..

I have two workbooks; one that serves as a database for all the materials my company ever uses, and another that servers as an individual Bill of Materials (BOM) for each project.

The database is complete, with columns for partID, name, manufacturer, part#, etc. It also has every part occurring only once, as it should. Therefor, each part# should only occur once.

The BOM, however, has many instances where parts are repeated because the same part can be used in many different sections of the project.
The BOM does have a column for partID, but it has not yet been filled in, and I am trying to avoid filling it in manually, as there are 1000s of parts listed.
It also has columns for name, manufacturer, part#, etc, all of which are already populated. The name could be a long description, and the manufacturer can be the same across many parts, so to me, the part# column is the useful identifier between the two workbooks.

So basically, I am assuming that I will need to write some sort of macro procedure that will copy partID from the Database.xlsx to BOM.xlsx if column "part#" is the same between the two workbooks. Is this correct to assume?

Any tips or references of where to start? Anything would be helpful!

Thanks! :rolleyes:
 
Last edited:
I'm not sure if I'm following.

FYI:
BOM headers are on line 5, all entries start on line 6
Part_ID (L5)
Manufacturer (O5)
Model_Number (P5)
Primary_Vendor (Q5)
Alternate_Vendor (R5)
Cost_CND (S5)

Quote table headers are on line 1, all entries start on line 2
Part_ID (A1)
Manufacturer (C1)
Model_Number (D1)
Primary_Vendor (E1)
Alternate_Vendor (F1)
Cost_CND (G1)

I put it as:
=INDEX(quote!$C$2:$G$377,MATCH([CW_ID],quote!$A$2:$A$377,0),MATCH($O$5,quote!C1:G1, 0))
Doesn't work
 
Last edited:
Upvote 0

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.
Best if ranges start in top left, so a1 for index, row & col, hope that makes sense.

=INDEX(Quote!$A$1:$G$377,MATCH([CW_ID],Quote!$A$1:$A$377,0),MATCH($O$5,Quote!A1:G1,
 
Upvote 0
I can't seem to get this formula to work.

Am I pasting this formula into the first cell I want to be populated (In this case, its in the manufacturers field of the BOM)

It doesn't work with =INDEX(Quote!$A$1:$G$377,
I can only get it to work with the first MATCH and only if it's
=INDEX(Quote!$C$1:$C$377 because that is the manufacturers column for quotes

As soon as I try adding the second MATCH, the formula does not work.
:confused:

=INDEX(quote!$C$1:$C$377,MATCH([CW_ID],quote!$A$1:$A$377,0)) < This works
=INDEX(quote!$A$1:$G$377,MATCH([CW_ID],quote!$A$1:$A$377,0)) < This does not work
=INDEX(quote!$A$1:$G$377,MATCH([CW_ID],quote!$A$1:$A$377,0),MATCH($O$5,quote!A1:G1,0)) < This does not work
 
Upvote 0
The 2nd one won't work as it doesn't know which column to look at.
The 3rd one should, providing that the Header Name in O5 matches the Header your looking for in Quotes $A$1:$G$1
=INDEX(quote!$A$1:$G$377,MATCH([CW_ID],quote!$A$1:$A$377,0),MATCH($O$5,quote!$A$1:$G$1,0)) < This does not work

Post a sample of your spreadsheet? Or upload to dropbox?
 
Upvote 0
BOM:

24xmbsw.png




Quotes Table:
2d6levp.png




I have gotten the following formula to work for manufacturers, however it does not work for the other columns:

=INDEX(quote!$A:$G, MATCH(BOM!$A2,quote!$A:$A,0),MATCH(O$1,quote!$1:$1,0)) (From cell O2)

*ignore that the quotes table appears to start from ID 1043
 
Last edited:
Upvote 0
Try, adjust the 39 row range & G column range to cover your data BUT don't select whole columns.
=INDEX(Quote!$A$1:$G$39,MATCH(BOM!$A2,Quote!$A$1:$A$39,0),MATCH(BOM!O$1,Quote!$A$1:$G$1,0))
 
Upvote 0

Forum statistics

Threads
1,216,176
Messages
6,129,318
Members
449,501
Latest member
Amriddin

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