Formula to give country name from country code

Hello,

As I see, there is no formula in Calc which would get as input country ISO code and would give as output full country name, or vice versa.

I would like to ask if I can make such formula for myself and how.

Sincerely,
Nikola

[edit]

with some effort a search over multiple columns is possible,
but may bring trouble with ambiguous data …

sample for search in multiple columns

works as long as all values are unique,


feel free to enhance …

[/edit]

if you have a list lookup (hlookup / vlookup) will do the job for you, while there are plenty other possibilities with sumifs? sumproduct, macros and so on …

=VLOOKUP(I39;I34:J36;2;0)

searches an exact match - 0 - of the value of I39 in I34:I39 (first column) and results the value from J34:J39 (second column).

I see what you mean. That is OK and doesn’t take much time. Even better would be to make (if possible) new single function which will give as a result the name of the country. For example, if in cell A1 I have DE, I enter that function in cell B1, apply it to A1 and get Germany in B1. That will save me some time if I work often with country names. Is this possible?

Yes that’s possible. see here

considering this: ‘or vice versa’, this: ‘A1 is “DE”’, this: 'or “DEU”, this: ‘or “276”’, and possible future wishes as: ‘or “GER”’, expand- / reduceability for new or lost states and fuzzy approaces with parts of names i’d say user editable lists and vlookup could do that … first approach in edited answer …

Hello,

the following macro function should do the job. Just place it in “Tools” > “Macros” > “Edit Macros…” and you can call it from inside any cell like any other function.

Examples:

 =COUNTRYCODE2NAME("DE")
 =COUNTRYCODE2NAME("ALA")
 =COUNTRYCODE2NAME(850)
 =COUNTRYCODE2NAME("sB")
 =COUNTRYCODE2NAME("eCu")

Here the macro function:

Function COUNTRYCODE2NAME(code as String)
   
    REM remove preceding and trailing spaces and convert to uppercase
    code=UCase(Trim(code))
   
    REM https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
	Set names=Array("Afghanistan","Åland Islands","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica [a]","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia [b]","Austria","Azerbaijan","Bahamas (the)","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia (Plurinational State of)","Bonaire Sint Eustatius Saba","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory (the)","Brunei Daru alam [e]","Bulgaria","Burkina Faso","Burundi","Cabo Verde [f]","Cambodia","Cameroon","Canada","Cayman Islands (the)","Central African Republic (the)","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands (the)","Colombia","Comoros (the)","Congo (the Democratic Republic of the)","Congo (the) [g]","Cook Islands (the)","Costa Rica","Côte d'Ivoire [h]","Croatia","Cuba","Curaçao","Cyprus","Czechia [i]","Denmark","Djibouti","Dominica","Dominican Republic (the)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini [j]","Ethiopia","Falkland Islands (the) [Malvinas] [k]","Faroe Islands (the)","Fiji","Finland","France [l]","French Guiana","French Polynesia","French Southern Territories (the) [m]","Gabon","Gambia (the)","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bi au","Guyana","Haiti","Heard Island and McDonald Islands","Holy See (the) [n]","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran (Islamic Republic of)","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Korea (the Democratic People's Republic of) [o]","Korea (the Republic of) [p]","Kuwait","Kyrgyzstan","Lao People's Democratic Republic (the) [q]","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao [r]","North Macedonia [s]","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands (the)","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia (Federated States of)","Moldova (the Republic of)","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar [t]","Namibia","Nauru","Nepal","Netherlands (the)","New Caledonia","New Zealand","Nicaragua","Niger (the)","Nigeria","Niue","Norfolk Island","Northern Mariana Islands (the)","Norway","Oman","Pakistan","Palau","Palestine, State of","Panama","Papua New Guinea","Paraguay","Peru","Philippines (the)","Pitcairn [u]","Poland","Portugal","Puerto Rico","Qatar","Réunion","Romania","Ru ian Federation (the) [v]","Rwanda","Saint Barthélemy","Saint Helena Ascension Island Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin (French part)","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten (Dutch part)","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Sudan","Spain","Sri Lanka","Sudan (the)","Suriname","Svalbard Jan Mayen","Sweden","Switzerland","Syrian Arab Republic (the) [x]","Taiwan (Province of China) [y]","Tajikistan","Tanzania, the United Republic of","Thailand","Timor-Leste [aa]","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Turks and Caicos Islands (the)","Tuvalu","Uganda","Ukraine","United Arab Emirates (the)","United Kingdom of Great Britain and Northern Ireland (the)","United States Minor Outlying Islands (the) [ac]","United States of America (the)","Uruguay","Uzbekistan","Vanuatu","Venezuela (Bolivarian Republic of)","Viet Nam [ae]","Virgin Islands (British) [af]","Virgin Islands (U.S.) [ag]","Wallis and Futuna","Western Sahara [ah]","Yemen","Zambia","Zimbabwe")
	Set codes2L=Array("AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","BN","BG","BF","BI","CV","KH","CM","CA","KY","CF","TD","CL","CN","CX","CC","CO","KM","CD","CG","CK","CR","CI","HR","CU","CW","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","SZ","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SX","SK","SI","SB","SO","ZA","GS","SS","ES","LK","SD","SR","SJ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","UM","US","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","ZM","ZW")
	Set codes3L=Array("AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA","IOT","BRN","BGR","BFA","BDI","CPV","KHM","CMR","CAN","CYM","CAF","TCD","CHL","CHN","CXR","CCK","COL","COM","COD","COG","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","SWZ","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF","GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","VAT","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","MNP","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","REU","ROU","RUS","RWA","BLM","SHN","KNA","LCA","MAF","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SXM","SVK","SVN","SLB","SOM","ZAF","SGS","SSD","ESP","LKA","SDN","SUR","SJM","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA","UKR","ARE","GBR","UMI","USA","URY","UZB","VUT","VEN","VNM","VGB","VIR","WLF","ESH","YEM","ZMB","ZWE")
	Set codesNr=Array("4","248","8","12","16","20","24","660","10","28","32","51","533","36","40","31","44","48","50","52","112","56","84","204","60","64","68","535","70","72","74","76","86","96","100","854","108","132","116","120","124","136","140","148","152","156","162","166","170","174","180","178","184","188","384","191","192","531","196","203","208","262","212","214","218","818","222","226","232","233","748","231","238","234","242","246","250","254","258","260","266","270","268","276","288","292","300","304","308","312","316","320","831","324","624","328","332","334","336","340","344","348","352","356","360","364","368","372","833","376","380","388","392","832","400","398","404","296","408","410","414","417","418","428","422","426","430","434","438","440","442","446","807","450","454","458","462","466","470","584","474","478","480","175","484","583","498","492","496","499","500","504","508","104","516","520","524","528","540","554","558","562","566","570","574","580","578","512","586","585","275","591","598","600","604","608","612","616","620","630","634","638","642","643","646","652","654","659","662","663","666","670","882","674","678","682","686","688","690","694","702","534","703","705","90","706","710","239","728","724","144","729","740","744","752","756","760","158","762","834","764","626","768","772","776","780","788","792","795","796","798","800","804","784","826","581","840","858","860","548","862","704","92","850","876","732","887","894","716")
	
	
	For i = LBound(names) To UBound(names)
		Select Case code
			Case codes2L(i), codes3L(i), codesNr(i)
			COUNTRYCODE2NAME=names(i)
			Exit Function
		End Select
	Next 
	COUNTRYCODE2NAME="unknown country code"
End Function

Hope that helps.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Have a nice day and let’s (continue to) “Be excellent to each other!”

Thank you very much! This does great job.

In connection with this, since I don’t have much experience with macros, do you think it would be easy to modify the code to include 3-letter codes and numerical codes? For example:

If in cell A1 is “DE” or “DEU” or “276”, then to get “Germany” in B1 (or other cell).

Sure, thats easy, i’ll update the answer shortly.

[updated] should now work with the 2 and 3 Letters codes as well as the numerical codes

Does Basic support multi-dimensional arrays? They might be quicker than looping through all elements of a one dimensional array.

Not as far as i know, i would have prefered to use a hashmap, but there doesnt seem to be such a datatype either.

Does Basic support multi-dimensional arrays?

Yes. See → Arrays

I use two dimensional Arrays on a regular basis.

@Ratslinger: Thanks. Good to know, I am still quite new to basic so i am definetly not using all there is.
@robleyd: And how would you now propose the solution could be improved?

Ignore my comment; I was actually thinking of hashmaps also, not multi dimensional arrays.

@igorlius Thanks for the update. With this I always get “unknown country code”. Should I change the format of the cell with the code or something else? Update: Found the problem. The letters should be all capital.

My bad, i forgot to include the input sanatization

code=UCase(Trim(code))

Now it should work with both upper and lowercase input.

Hello,

the following macro function should do the job. Just place it in “Tools” > “Macros” > “Edit Macros…” and you can call it from inside any cell like any other function.

Examples:

 =COUNTRYCODE2NAME("DE")
 =COUNTRYCODE2NAME("ALA")
 =COUNTRYCODE2NAME(850)
 =COUNTRYCODE2NAME("sB")
 =COUNTRYCODE2NAME("eCu")

Here the macro function:

Function COUNTRYCODE2NAME(code as String)
   
    REM remove preceding and trailing spaces and convert to uppercase
    code=UCase(Trim(code))
   
    REM https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
	Set names=Array("Afghanistan","Åland Islands","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica [a]","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia [b]","Austria","Azerbaijan","Bahamas (the)","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia (Plurinational State of)","Bonaire Sint Eustatius Saba","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory (the)","Brunei Daru alam [e]","Bulgaria","Burkina Faso","Burundi","Cabo Verde [f]","Cambodia","Cameroon","Canada","Cayman Islands (the)","Central African Republic (the)","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands (the)","Colombia","Comoros (the)","Congo (the Democratic Republic of the)","Congo (the) [g]","Cook Islands (the)","Costa Rica","Côte d'Ivoire [h]","Croatia","Cuba","Curaçao","Cyprus","Czechia [i]","Denmark","Djibouti","Dominica","Dominican Republic (the)","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini [j]","Ethiopia","Falkland Islands (the) [Malvinas] [k]","Faroe Islands (the)","Fiji","Finland","France [l]","French Guiana","French Polynesia","French Southern Territories (the) [m]","Gabon","Gambia (the)","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bi au","Guyana","Haiti","Heard Island and McDonald Islands","Holy See (the) [n]","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran (Islamic Republic of)","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Korea (the Democratic People's Republic of) [o]","Korea (the Republic of) [p]","Kuwait","Kyrgyzstan","Lao People's Democratic Republic (the) [q]","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao [r]","North Macedonia [s]","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands (the)","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia (Federated States of)","Moldova (the Republic of)","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar [t]","Namibia","Nauru","Nepal","Netherlands (the)","New Caledonia","New Zealand","Nicaragua","Niger (the)","Nigeria","Niue","Norfolk Island","Northern Mariana Islands (the)","Norway","Oman","Pakistan","Palau","Palestine, State of","Panama","Papua New Guinea","Paraguay","Peru","Philippines (the)","Pitcairn [u]","Poland","Portugal","Puerto Rico","Qatar","Réunion","Romania","Ru ian Federation (the) [v]","Rwanda","Saint Barthélemy","Saint Helena Ascension Island Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin (French part)","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten (Dutch part)","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Sudan","Spain","Sri Lanka","Sudan (the)","Suriname","Svalbard Jan Mayen","Sweden","Switzerland","Syrian Arab Republic (the) [x]","Taiwan (Province of China) [y]","Tajikistan","Tanzania, the United Republic of","Thailand","Timor-Leste [aa]","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Turks and Caicos Islands (the)","Tuvalu","Uganda","Ukraine","United Arab Emirates (the)","United Kingdom of Great Britain and Northern Ireland (the)","United States Minor Outlying Islands (the) [ac]","United States of America (the)","Uruguay","Uzbekistan","Vanuatu","Venezuela (Bolivarian Republic of)","Viet Nam [ae]","Virgin Islands (British) [af]","Virgin Islands (U.S.) [ag]","Wallis and Futuna","Western Sahara [ah]","Yemen","Zambia","Zimbabwe")
	Set codes2L=Array("AF","AX","AL","DZ","AS","AD","AO","AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY","BE","BZ","BJ","BM","BT","BO","BQ","BA","BW","BV","BR","IO","BN","BG","BF","BI","CV","KH","CM","CA","KY","CF","TD","CL","CN","CX","CC","CO","KM","CD","CG","CK","CR","CI","HR","CU","CW","CY","CZ","DK","DJ","DM","DO","EC","EG","SV","GQ","ER","EE","SZ","ET","FK","FO","FJ","FI","FR","GF","PF","TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GG","GN","GW","GY","HT","HM","VA","HN","HK","HU","IS","IN","ID","IR","IQ","IE","IM","IL","IT","JM","JP","JE","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS","LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH","MQ","MR","MU","YT","MX","FM","MD","MC","MN","ME","MS","MA","MZ","MM","NA","NR","NP","NL","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM","PK","PW","PS","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO","RU","RW","BL","SH","KN","LC","MF","PM","VC","WS","SM","ST","SA","SN","RS","SC","SL","SG","SX","SK","SI","SB","SO","ZA","GS","SS","ES","LK","SD","SR","SJ","SE","CH","SY","TW","TJ","TZ","TH","TL","TG","TK","TO","TT","TN","TR","TM","TC","TV","UG","UA","AE","GB","UM","US","UY","UZ","VU","VE","VN","VG","VI","WF","EH","YE","ZM","ZW")
	Set codes3L=Array("AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA","IOT","BRN","BGR","BFA","BDI","CPV","KHM","CMR","CAN","CYM","CAF","TCD","CHL","CHN","CXR","CCK","COL","COM","COD","COG","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","SWZ","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF","GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","VAT","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","MNP","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","REU","ROU","RUS","RWA","BLM","SHN","KNA","LCA","MAF","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SXM","SVK","SVN","SLB","SOM","ZAF","SGS","SSD","ESP","LKA","SDN","SUR","SJM","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA","UKR","ARE","GBR","UMI","USA","URY","UZB","VUT","VEN","VNM","VGB","VIR","WLF","ESH","YEM","ZMB","ZWE")
	Set codesNr=Array("4","248","8","12","16","20","24","660","10","28","32","51","533","36","40","31","44","48","50","52","112","56","84","204","60","64","68","535","70","72","74","76","86","96","100","854","108","132","116","120","124","136","140","148","152","156","162","166","170","174","180","178","184","188","384","191","192","531","196","203","208","262","212","214","218","818","222","226","232","233","748","231","238","234","242","246","250","254","258","260","266","270","268","276","288","292","300","304","308","312","316","320","831","324","624","328","332","334","336","340","344","348","352","356","360","364","368","372","833","376","380","388","392","832","400","398","404","296","408","410","414","417","418","428","422","426","430","434","438","440","442","446","807","450","454","458","462","466","470","584","474","478","480","175","484","583","498","492","496","499","500","504","508","104","516","520","524","528","540","554","558","562","566","570","574","580","578","512","586","585","275","591","598","600","604","608","612","616","620","630","634","638","642","643","646","652","654","659","662","663","666","670","882","674","678","682","686","688","690","694","702","534","703","705","90","706","710","239","728","724","144","729","740","744","752","756","760","158","762","834","764","626","768","772","776","780","788","792","795","796","798","800","804","784","826","581","840","858","860","548","862","704","92","850","876","732","887","894","716")
	
	
	For i = LBound(names) To UBound(names)
		Select Case code
			Case codes2L(i), codes3L(i), codesNr(i)
			COUNTRYCODE2NAME=names(i)
			Exit Function
		End Select
	Next 
	COUNTRYCODE2NAME="unknown country code"
End Function

Hope that helps.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Have a nice day and let’s (continue to) “Be excellent to each other!”