Vlookup macro

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 10:03 PM GMT

Question

I have 2columns below: Country Countrycode Austria AT USA US unitedkingdom Uk India IN Bermuda BM

now i have country in another sheet now i need to get the respective country codes for those countries how do i do?.Also suppose i have 10countries in onesheet and the it's country code should be filled in automatically . Please write up a vlookup macro to help.

Many Pravee

Answer

Pravee

Assume your list of countries and their codes is in sheet2 cells A1 thru B100, with column A being the country and column B being the country code. Also assume your list of countries which you wish to look the country codes is in column A of another sheet. The formula would look like this +=VLOOKUP(A1,Sheet2!A$1:B$100,2,FALSE)

The formula says go to sheet2 cells A1 thru B100 and lookup the value from cell A1 (in this sheet or the sheet that you are putting the formula in) if you find the value then return the value form the same row but the second column of the arange (this is column B in this formula). The false in the formula tellsto find an exact match.

Advertisement

©2021 eLuminary LLC. All rights reserved.