Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2002: copy between worksheets based on matching criteria 1

Status
Not open for further replies.

CharlieMike73

Programmer
May 17, 2002
120
US
I have a MS Excel 2002 Workbook with two worksheets (lets call them sheet A & B).

On sheet A I have a list of names along with a number of other columns of data. Some of the names in this list are repeated, which is required as data in the other columns is different.

On sheet B I have a list of names and their respective location codes.

What I need to do is take each name from sheet A and find that name in sheet B and then copy the location code from sheet B back over to a column on sheet A - does that make sense?

All the names on sheet A exist on sheet B also (plus some), the names however are not always in the same letter case. Some are all uppercase, some lowercase and some are mixed case.

A macro or an equation is fine... whatever works... and it does not need to dynamically update as the location codes change, but that would help.

Earn extra points... if it would be easier, I imported the name and location data on sheet B from a database using the Excel data import query builder, but could not figure out how to reference the names in sheet A to match the data to when retrieving the location codes.

Regards,
Charlie
 
in the column that you need the codes use the VLOOKUP function with sheet B like:

=VLOOKUP(A1,Sheet2!A1:B3,2)

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 




Hi,

Check out the VLOOKUP function to use the name on sheet A to return a value from sheet B. Alternatively, you can use the INDEX and MATCH functions.

It is also possible to write a function in VBA that would return a value from your database, depending on the parameter you would supply. If you wish to see an example, please repost your question in Forum707.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top