coder_bg
coder_bg

Reputation: 370

How to use VLOOKUP function in MS Excel

I am very very new to Excel I have two sheets Sheet 1

Country PMU             Cluster
A       Asia            Mercury
B       Australia       Venus
C       North America   Jupiter

All the countries and continents are unique here In sheet 2 I have

CountryCode Country  PMU  Cluster
123         A
234         A
453         B
235         C

1 country can have multiple codes I have to take the PMU and Cluster and merge it with Sheet 2 , sheet 2 will have an additional column of Country Code. Any help is very much apprciated.

Upvotes: 0

Views: 842

Answers (1)

Isolated
Isolated

Reputation: 6454

Replacing my answer per your edits.

I'm just doing this on a single sheet but you can easily adapt by pointing to your other sheet for your lookup array.

Here is the formula for cell G2:

    ==VLOOKUP($F2,$A:$C,2,FALSE)

Here is the formula for cell H2:

    =VLOOKUP($F2,$A:$C,3,FALSE)

Drag your formulas down and you're done. Vlookup formulas are very useful I recommend looking up how they work as someone else could better explain than I. Basically, you are looking up a value (column F) in an array (columns A,B,C) and returning a column index (B = 2, C = 3, etc) for a match. Lastly, you are looking for an approximate (TRUE) or exact (FALSE) match. Almost always use FALSE.

Also, look up cell references and how to lock them (ie, how $ signs rules vary). That way you can easily drag formulas across and keep your lookup value and array the same.

enter image description here

Upvotes: 1

Related Questions