Let me try to rephrase what you want to confirm I understand this:
- You have a list of products in file A with a price for each product
- You have a list of the same products in file B with a price for each product
- The price for a given product can be different in the two files
- In file A you want to do a comparison of the two prices
- You want to be able to sort the product list in file B arbitrarily and still be able to reference the corresponding products from file A.
I am going to suggest that your approach of trying to find a formula in file A that uses a row number that will always refer to the correct product in file B when the row changes in column B is not going to work.
Another approach is to use the product to do a lookup of the price. Unfortunately the VLOOKUP command (XLOOKUP in newer versions of Excel) will not work on a closed workbook. I am going to suggest you create a mirror sheet in file A that references the data in file B. Then you can use VLOOKUP on the mirror sheet to retrieve the price.
1. Create a new sheet in file A. Name it Mirror. Put this formula in cell A1:
Instead of B use the actual last column of data you want to reference, and obviously, use the real file name.
Copy this formula to the right for as many columns as needed, and down for the maximum number of products you expect to ever have.
Close File B if it is open. The data in sheet Mirror should still be there.
2. You have not described the layout of your data in either file, so I am going to have to make assumptions. You may have to change the column references here.
In file B assume that Product is in column A, price is in column B. This will also be true in file A, sheet Mirror.
In File A assume the sheet containing the product list is in Sheet1, and also the product is in column A and price is in column B.
In File A Sheet1, put the following formula in C1 to get the price of the product in the row from file B:
Fill down for as many rows as needed.
If you have any problem implementing this, attach samples of File A and File B with any private data removed or disguised and I can do it for you.
Bookmarks