Link to home
Start Free TrialLog in
Avatar of Curly101
Curly101

asked on

Excel 2010: Copy content of cell, based on lookup in another worksheet

I have 2 files. Both have Item # column and Description column.

In file 1, I need to search in file 2 for the Item #. If it finds it, I need to copy the content of the Description cell in file 1 and paste in the the description cell in file 2.

I would like to be able to drag the cell down through the spreadsheet so that it fills in the rest of the rows.

Any help is appreciated!
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

You should be able to useVLOOKUP for this, have you used VLOOKUP before?

regards, barry
Avatar of Curly101
Curly101

ASKER

I have seen it, but cant figure out how to get it to copy the contents of the Description field if it finds a match in the Item # field.
Say you have item numbers in column A in both files and in file 2 you also have the descriptions in column B then in file 1 B2 you can use a formula like this

=VLOOKUP(A2,'[file 2.xlsx]Sheet1'!$A$:$B$,2,0)

copy down column

[assumes both workbooks are open at this point - you can close the source workbook after the formula is set up]

If the columns are further apart you will have to adjust this.

If the description field is to the left of the item field then you need a different formula....

If you can't get that to work then please give more details - in which columns exactly is the data?

regards, barry

Barry,

I'm getting a #NA.

=VLOOKUP(A2,'[dataexport.xlsx]Products!$A$:$B$,2,0)

The description field that I need is Column C
And where are the item number, column A?

In VLOOKUP the "lookup value" (in this case A2) is looked up in the first column of the "lookup range" (in this case '[dataexport.xlsx]Products!$A$:$B$, so the first column is column A....and the "column index" (2 here defines which column to return a value from...so if you need to lookup the value in column A and return the value from C you need to change the range and make the column index 3, i.e.

=VLOOKUP(A2,'[dataexport.xlsx]Products!$A$:$C$,3,0)

regards, barry
Column A is correct for both files
Ok so that last formula should work for you assuming there are exact matches with the item #s....

barry
Sorry, Barry. Not working.

When I paste in the formula, I'm getting an error that "The name that you entered is not valid." Does not begin with a letter or an underscore...the name contains a space or other invalid character.

When I hit Enter, it highlights: '[dataexport.xlsx]Products


I am putting this formula in the destination file, not the source, right? I am putting it on row2, in the cell where I want the description to be copied to.

Thanks

Sorry, the are two typos in there - you need to remove the  apostrophe before the filename  (in my original there are apostrophes around the file/sheet names because the file name contained a space - you don't need those)...and there are too many $ signs in my original - try this version

=VLOOKUP(A2,[dataexport.xlsx]Products!$A:$C,3,0)

regards, barry
That worked Barry...thanks. But when I copied the field to the next cell down, it put in the same info as the original. How do I get it to move to the next item #?
ASKER CERTIFIED SOLUTION
Avatar of barry houdini
barry houdini
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Barry,

All worked perfectly. Thanks for everything!