MrExcel Publishing
Your One Stop for Excel Tips & Solutions

How do I match codes and get a value


Posted by Denise on December 05, 2000 7:25 AM

Help! I want to create a formula that allows me to match codes and return a text value.

Ex:
One sheet says: sheet two says:
Code 111 food Code 111
Code 112 water Code 112
Code 114 air Code 114

What kind of formula will allow me to bring the food, water, air into sheet 2 based on matching code #?

Thanks in advance for your help.


Posted by Aladin Akyurek on December 05, 2000 7:44 AM

Give a name to the range that contains data, e.g. DATA.
Type the following formula in b1 on sheet 2, supposing that the first code is in A1:

=VLOOKUP(a1,DATA,2,FALSE)

2 refers to the column number of the table DATA where the values like food, water, etc. are. And copy down the formula as far as needed.

Aladin