Cross Reference in Two Files

jarett

Board Regular
Joined
Apr 12, 2021
Messages
165
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am sure this is a routinely run task but I am not sure the correct terminology of the task to search on it. I have have two different files, file "abc" has column A as "UPC" and column "E" as inventory qty. In file "#2" I have column "C" as "UPC", I want to take the column "E" from file "abc" and import it into file "#2" in a new column next to the corresponding "UPC" record. Is this called a look up? Can this task be automated in a macro?
 
Give this a try:
=index('[Lapco_inv.xlsx]Sheet1'!$A$2:$E$10000,match(C1,'[Lapco_inv.xlsx]Sheet1'!$A$2:$A$10000,0),2)

Replace Sheet1 with whatever your tab name is.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Well a little progress, got a N/A result, some reason it shortens the formula and takes out the tab name when I paste it into the formula bar.
=INDEX(LAPCO_INV.xlsx!$A$2:$E$10000,MATCH(C1,LAPCO_INV.xlsx!$A$2:$A$10000,0),2)

I might be able to dissect it now that its a real formula.
 
Upvote 0
Okay, give this a try. Have both files open. When editing the formula, highlight this piece:
LAPCO_INV.xlsx!$A$2:$E$10000
then go to your lapco sheet and select range A2:E10
hit enter.
Your formula should now reference the correct sheet and you can manually update your range to E10000.
 
Upvote 0
Okay, give this a try. Have both files open. When editing the formula, highlight this piece:
LAPCO_INV.xlsx!$A$2:$E$10000
then go to your lapco sheet and select range A2:E10
hit enter.
Your formula should now reference the correct sheet and you can manually update your range to E10000.
ok tried that and this is my formula now after manually updating the range.

=INDEX(LAPCO_INV.xlsx!$A$2,LAPCO_INV.xlsx!$E$10000,MATCH(C1,LAPCO_INV.xlsx!$A$2:$A$10000,0),2)

So the values I am trying to "match" up are UPC codes and excel is storing them in the weird scientific format "8.41E+11", thats how they look in the cell but the cell format is set to general, could this be a reason as well?
 
Upvote 0
not quite there. Change LAPCO_INV.xlsx!$A$2,LAPCO_INV.xlsx!$E$10000 back to
LAPCO_INV.xlsx!$A$2:$E$10000
It could be the cell format. Maybe try changing them to a text field in both workbooks.
 
Upvote 0
Still error, maybe I have the formula all wrong, because I am trying to return the value in "LAPCO_INV" column E (QUANTITY), in "UPCTEST" file in the same row with the corresponding UPC. Which part of the formula is the return value when the statement is true?
 
Upvote 0
Can you use the xl2bb addin from this site and post samples of both sheets?
 
Upvote 0
Well, I finally got it to work,
=INDEX(LAPCO_INV.xlsx!$A$2:$E$10000,MATCH(C4154,LAPCO_INV.xlsx!$A$2:$A$10000,0),5)

A couple things wrong on my side, had the wrong column reference for the result and the biggest issue was all the UPC numbers being supplied were missing the last digit, that's why I kept getting the N/A.

Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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