KutoolsforOffice — One Suite. Five Tools. Get More Done.

How to Convert Country Names to ISO Codes and Vice Versa in Excel?

AuthorXiaoyangLast modified

Country names and ISO country codes are commonly used in customer databases, international sales reports, shipping records, and geographic analysis. However, one worksheet may contain full country names such as United States, while another system requires two-letter codes such as US or three-letter codes such as USA.

To convert country names to ISO codes in Excel, you can:

  1. Use an Excel lookup formula with a country-code reference table.
  2. Use the Convert Country Names and ISO Codes feature in Kutools for Excel to perform the conversion directly.

This guide explains how to convert country names to ISO Alpha-2 or Alpha-3 codes, as well as how to convert ISO codes back to full country names.

Convert Country Names and ISO Codes


What Are ISO Country Codes?

ISO country codes are standardized abbreviations used to identify countries and territories.

  • ISO2, or an alpha-2 code, consists of two letters, such as US, CA, or JP, and is widely used on websites, in databases and addresses, and for regional settings.
  • ISO3, or an alpha-3 code, consists of three letters, such as USA, CAN, or JPN, and is generally easier to recognize in reports, international datasets, and data exchange systems.

The two most commonly used formats are:

Country nameISO Alpha-2 codeISO Alpha-3 code
United StatesUSUSA
United KingdomGBGBR
CanadaCACAN
GermanyDEDEU
FranceFRFRA
JapanJPJPN
ChinaCNCHN
AustraliaAUAUS
IndiaININD
BrazilBRBRA

Method 1: XLOOLKUP function (Excel 2021 and later versions / Office 365)

Using a formula is a practical choice when you want the converted results to update automatically whenever the source data changes.

However, formulas require a reference table containing the country names and their corresponding ISO codes.

XLOOKUP Syntax:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value: The value you want to find.
  • lookup_array: The cell range in which Excel searches for the lookup value.
  • return_array: The range containing the result you want to return.
  • [if_not_found]: Optional. Specifies the text or value to return when no match is found. If omitted, Excel returns #N/A.
  • [match_mode]: Optional. Specifies the matching method:
    • 0 – Exact match; this is the default.
    • -1 – Exact match or next smaller value.
    • 1 – Exact match or next larger value.
    • 2 – Wildcard match.
  • [search_mode]: Optional. Specifies the search direction:
    • 1 – Search from first to last; this is the default.
    • -1 – Search from last to first.
    • 2 – Binary search in ascending order.
    • -2 – Binary search in descending order.

First, create a country-code reference table, copy the following table, which contains all country names and their corresponding codes, and paste it into the worksheet where you want to perform the conversion.

CountryISO Alpha-2ISO Alpha-3
AfghanistanAFAFG
AlbaniaALALB
AlgeriaDZDZA
American SamoaASASM
AndorraADAND
AngolaAOAGO
AnguillaAIAIA
AntarcticaAQATA
Antigua and BarbudaAGATG
ArgentinaARARG
ArmeniaAMARM
ArubaAWABW
AustraliaAUAUS
AustriaATAUT
AzerbaijanAZAZE
Bahamas (the)BSBHS
BahrainBHBHR
BangladeshBDBGD
BarbadosBBBRB
BelarusBYBLR
BelgiumBEBEL
BelizeBZBLZ
BeninBJBEN
BermudaBMBMU
BhutanBTBTN
Bolivia (Plurinational State of)BOBOL
Bonaire, Sint Eustatius and SabaBQBES
Bosnia and HerzegovinaBABIH
BotswanaBWBWA
Bouvet IslandBVBVT
BrazilBRBRA
British Indian Ocean Territory (the)IOIOT
Brunei DarussalamBNBRN
BulgariaBGBGR
Burkina FasoBFBFA
BurundiBIBDI
Cabo VerdeCVCPV
CambodiaKHKHM
CameroonCMCMR
CanadaCACAN
Cayman Islands (the)KYCYM
Central African Republic (the)CFCAF
ChadTDTCD
ChileCLCHL
ChinaCNCHN
Christmas IslandCXCXR
Cocos (Keeling) Islands (the)CCCCK
ColombiaCOCOL
Comoros (the)KMCOM
Congo (the Democratic Republic of the)CDCOD
Congo (the)CGCOG
Cook Islands (the)CKCOK
Costa RicaCRCRI
CroatiaHRHRV
CubaCUCUB
CuraçaoCWCUW
CyprusCYCYP
CzechiaCZCZE
Côte d'IvoireCICIV
Åland IslandsAXALA
 

Convert Country Names to ISO Codes

Supposing, I paste the reference table in cell A1:C250, and my data range in E1:F14, see screenshot:

paste the reference table into your sheet

Return ISO Alpha-2 Codes

Enter the following formula in G2:

=XLOOKUP(F2,$A$2:$A$250,$B$2:$B$250,"Not found")

Press Enter, and then drag the fill handle down to convert the remaining country names.

apply xlookup to Return ISO Alpha-2 Codes

How the formula works?

  • F2: lookup value - is the country name you want to find.
  • $A$2:$A$250: lookup array - contains the full country names.
  • $B$2:$B$250: return array - contains the ISO Alpha-2 codes.
  • "Not found" is returned when Excel cannot find an exact match.

Return ISO Alpha-3 Codes

To return a three-letter ISO code, change the return range from column B to column C:

Enter the following formula in H2:

=XLOOKUP(F2,$A$2:$A$250,$C$2:$C$250,"Not found")

Press Enter, and then drag the fill handle down to convert the remaining country names.

apply xlookup to Return ISO Alpha-3 Codes

 

Convert ISO Codes to Country Names

If your worksheet contains two-letter or three-letter ISO codes, such as US, GB, CAN, or DEU, you can convert them into full country names for easier reading and reporting.

Convert ISO Alpha-2 Codes to Country Names

When the source column contains two-letter codes, reverse the lookup and return ranges. Use this formula:

=XLOOKUP(F2,$B$2:$B$250,$A$2:$A$250,"Not found")

Press Enter, and then drag the fill handle down to fill the formula into the other cells. This time, Excel searches the Alpha-2 column and returns the corresponding full country name.

apply xlookup to Convert ISO Alpha-2 Codes to Country Names

How the formula works?

  • F2: lookup value - is the country code you want to find.
  • $B$2:$B$250: lookup array - contains the ISO Alpha-2 codes.
  • $A$2:$A$250: return array - contains the full country names.
  • "Not found" is returned when Excel cannot find an exact match.

Convert ISO Alpha-3 Codes to Country Names

For three-letter country codes, use this formula:

=XLOOKUP(F2,$C$2:$C$250,$A$2:$A$250,"Not found")

Press Enter, and then drag the fill handle down to return the corresponding full country names.

apply xlookup to Convert ISO Alpha-3 Codes to Country Names

 

Convert Either Alpha-2 or Alpha-3 Codes to Country Names

When a column may contain a mixture of two-letter and three-letter ISO codes, use two XLOOKUP functions with IFERROR:

=IFERROR(XLOOKUP(F2,$C$2:$C$250,$A$2:$A$250),
XLOOKUP(F2,$B$2:$B$250,$A$2:$A$250,"Not found"))

Press Enter, and then drag the fill handle down to convert the remaining ISO codes into country names.

apply xlookup to Convert Either Alpha-2 or Alpha-3 Codes to Country Names

How the formula works?

This formula searches for the code in F2:

  • It first looks in C2:C250 and returns the corresponding country name from A2:A250.
  • If no match is found, IFERROR searches B2:B250 instead.
  • If neither lookup finds a match, it returns “Not found.”

It can therefore convert either an ISO3 or ISO2 code into the corresponding country name.


Method 2: VLOOLKUP or INDEX and MATCH function (Older Excel versions)

XLOOKUP is not available in Excel 2016 or Excel 2019. In these versions, you can use VLOOKUP or INDEX and MATCH instead.

 

Convert Country Names to Codes with VLOOKUP

VLOOKUP can be used to convert country names to ISO codes because the country-name column is located on the left side of the reference table, allowing the function to search for each country name and return the corresponding ISO code from a column to its right.

VLOOKUP Syntax:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
  • lookup_value: The value you want to find.
  • table_array: The table containing the lookup value and the result. The lookup value must be in the first column of this range.
  • col_index_num: The column number in the table from which the result should be returned. The first column is 1, the second column is 2, and so on.
  • [range_lookup]: Optional. Specifies the matching method:
    • FALSE or 0 – Returns an exact match.
    • TRUE or 1 – Returns an approximate match. The first column should be sorted in ascending order.

Return an Alpha-2 code

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

Press Enter, and then drag the fill handle down to return the corresponding Alpha-2 codes.

Return an Alpha-3 code

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

Press Enter, and then drag the fill handle down to return the corresponding Alpha-3 codes.

Return an Alpha-2 or 3 code with vlookup

In these formulas:

  • F2: lookup value - contains the country name.
  • $A$2:$C$250: table array – is the reference table.
  • 2 returns the second column, containing Alpha-2 codes.
  • 3 returns the third column, containing Alpha-3 codes.
  • FALSE requires an exact match.
 

Convert ISO Codes to Country Names with INDEX and MATCH

Because VLOOKUP can only search the first column of the lookup range, converting codes back to country names requires rearranging the reference table or using INDEX and MATCH.

General INDEX and MATCH Formula:

=INDEX(return_range, MATCH(lookup_value, lookup_range, 0))
  • return_range: The range containing the result you want to return.
  • lookup_value: The value you want to find.
  • lookup_range: The range in which Excel searches for the lookup value.
  • 0: Requires MATCH to find an exact match.

Convert Alpha-2 codes to country names

=INDEX($A$2:$A$250,MATCH(F2,$B$2:$B$250,0))

This formula searches for the ISO Alpha-2 code in F2 within column B, then returns the corresponding country name from column A.

Convert Alpha-2 codes to country names with index and match

How the formula works?

  • $A$2:$A$250: The return range containing the country names.
  • F2: The ISO code you want to find.
  • $B$2:$B$250: The lookup range containing the ISO Alpha-2 codes.
  • 0: Requires an exact match.
  • MATCH(...): Finds the relative position of the ISO code in column B.
  • INDEX(...): Returns the country name from the same position in column A.

Convert Alpha-3 codes to country names

=INDEX($A$2:$A$250,MATCH(F2,$C$2:$C$250,0))

This formula searches for the ISO Alpha-3 code in F2 within column C, then returns the corresponding country name from column A.

Convert Alpha-3 codes to country names with index and match

Convert either Alpha-2 or Alpha-3 codes to country names

If your data includes both Alpha-2 and Alpha-3 country codes, you can combine the INDEX and MATCH functions with IFERROR to return the corresponding country names. It can handle mixed codes such as US, CAN, DE, and JPN in the same column.

=IFERROR(INDEX($A$2:$A$250,MATCH(F2,$B$2:$B$250,0)),
INDEX($A$2:$A$250,MATCH(F2,$C$2:$C$250,0)))

This formula converts either an ISO Alpha-2 or ISO Alpha-3 code in cell F2 into its corresponding country name.

Convert either Alpha-2 or Alpha-3 codes to country names with index and match

How the formula works?

  • The first INDEX/MATCH searches for F2 in B2:B250, which contains ISO Alpha-2 codes.
  • If no match is found, IFERROR runs the second INDEX/MATCH and searches C2:C250, which contains ISO Alpha-3 codes.
  • Once a match is found, INDEX returns the corresponding country name from A2:A250.
 

Advantages and Limitations of the Formula Method

Advantages

  • Uses standard Excel functions.
  • Automatically updates when the source value changes.
  • Works well when the same reference table is used repeatedly.

Limitations

  • You must create or obtain a complete country-code reference table.
  • Country names must match the names in the reference table.
  • Alternate names and spelling variations may return “Not found.”
  • The reference list must be maintained when ISO records change.
  • Formulas return results in another column rather than converting the original cells directly.

Notes:

  • For example, United States, United States of America, and USA may be treated as different lookup values unless your reference table accounts for them.
  • Also note that some commonly used abbreviations are not official ISO codes. For example, the official Alpha-2 code for the United Kingdom is GB, although UK is frequently used in ordinary data.

Method 3: Convert Country Names and ISO Codes with Kutools for Excel

If you do not want to create a reference table or write lookup formulas, Kutools for Excel provides a dedicated Convert Country Names and ISO Codes feature.

It supports the following operations:

  • Convert country names to ISO2 codes.
  • Convert country names to ISO3 codes.
  • Convert ISO2 or ISO3 codes to country names.

This method is especially useful for processing a long list of countries directly within the selected Excel range.

Tip: Because the conversion may replace the selected cell values, copy the original column or save a backup before processing important data.

  1. Select the cells containing the country names or ISO codes you want to convert.
  2. Click Kutools > Content > Convert Country/Region Names and ISO Codes, see screenshot:

enable this Convert Country Names and ISO Codes feature

  1. In the dialog box, select the appropriate conversion option based on the format of your source data and the result you want to obtain. (here, I will choose Convert ISO2/ISO3 Codes to Country Names)

select options in the dialog box

  1. Click OK to apply the conversion.

get the result by kutools

Advantages of Kutools for Excel

Kutools for Excel provides a faster and more convenient way to convert country names and ISO codes without creating a reference table or writing lookup formulas.

  • No formulas required: Complete the conversion through a simple dialog box.
  • No reference table needed: Kutools includes the required country-name and ISO-code mappings.
  • Supports multiple conversions: Convert country names to ISO2 or ISO3 codes, or convert ISO codes back to country names.
  • Handles ISO2 and ISO3 codes: Convert mixed two-letter and three-letter codes using the same option.
  • Suitable for bulk processing: Convert an entire selected range at once.
  • Preview before applying: Review the converted results in the Preview pane before changing the worksheet.
  • Easy to use: Ideal for users who are unfamiliar with XLOOKUP, VLOOKUP, or INDEX and MATCH.

Try Kutools for Excel

Convert country names and ISO codes in just a few clicks, process entire ranges at once, and simplify many other repetitive Excel tasks.


Excel Formulas vs. Kutools for Excel

The best method depends on your Excel version, formula experience, and whether you want dynamic results or a quick direct conversion.

  • Use an Excel formula when the source data changes frequently and the results need to update automatically.
  • Use Kutools for Excel when you need a quick conversion without creating a country-code table, maintaining lookup ranges, or troubleshooting formulas.
MethodAdvantagesDisadvantagesBest for
XLOOKUPSimple, flexible, and supports lookups in any direction.Not available in some older Excel versions; requires a reference table.Dynamic lookups in newer Excel versions.
VLOOKUPEasy to use and widely supported.Only returns values to the right; requires a reference table.Basic left-to-right lookups.
INDEX and MATCHSupports left and right lookups and works in older Excel versions.More complex to write and understand.Flexible lookups when XLOOKUP is unavailable.
Kutools for ExcelNo formulas or reference table required; supports quick bulk conversion.Requires installation; results do not update automatically.Fast conversion of large data ranges.

Frequently Asked Questions (FAQs)

1

Can Excel convert a country name to an ISO code without a lookup table?

A standard worksheet formula needs a source that contains the relationship between country names and codes. Therefore, XLOOKUP, VLOOKUP, and INDEX/MATCH require a reference table. Kutools provides a direct conversion option without requiring you to build that table manually.

2

What is the easiest way to convert country names to codes in Excel?

For a one-time or bulk conversion, the Kutools Convert Country Names and ISO Codes feature is usually the easiest method because it does not require formulas or a separate mapping table.

For dynamic worksheets, XLOOKUP is more suitable because the converted result updates automatically when the source value changes.

3

Why does the formula return “Not found”?

Common causes include:

  • The country name is spelled differently from the reference table.
  • The cell contains leading or trailing spaces.
  • An abbreviation is used instead of the full country name.
  • The code is stored in the wrong lookup column.
  • The reference list does not contain the requested value.
4

Can I preserve the original country names when using Kutools?

Yes. Copy the country-name column to another location before running the conversion. You can then keep one column for the original names and another for the ISO codes.


Conclusion

There are two effective ways to convert country names to ISO codes and ISO codes back to country names in Excel.

Excel formulas such as XLOOKUP, VLOOKUP, and INDEX with MATCH are ideal when you already have a country-code reference table and need results that update dynamically.

For a faster bulk-conversion workflow, Kutools for Excel provides the dedicated Convert Country Names and ISO Codes feature. It can convert full country names to ISO2 or ISO3 codes and convert either code format back to country names without requiring a mapping table or lookup formula.

Choose the formula method for dynamic data and reusable models. Choose Kutools when you want to standardize country information quickly with fewer steps.