Back to Interzoid in Excel
SheetXAI logo
Interzoid logo
Interzoid · Excel Guide

Normalize a Messy Country Column and Enrich It With ISO Codes in an Excel workbook

2026-05-15
5 min read

The Scenario

The ETL load job failed again. You're a data engineer. The error log: "Invalid country code at row 4,821." The customer table in Excel has "US," "United States," "USA," "America," "U.S.," and 40 other variants. The destination schema expects ISO-3166 alpha-2 codes. Only.

The table has 10,000 rows. The ETL runs at 2 AM. This is the fourth late-night fix in two weeks.

The bad version:

  • Build a manual mapping table of every country variant — covers the ones you know about, misses the 12 edge cases you'll find next week.
  • Write a regex normalization function — works until someone submits "Россия" or "中国" and it returns null.
  • Page the on-call engineer, delay the load, document the incident again.

The downstream analytics dashboard reads from this table. The business review is Thursday.

The Easy Way: One Prompt in SheetXAI

SheetXAI reads your Excel workbook and calls Interzoid's country data API for every row.

For every country value in column D, call Interzoid to return the ISO-3166 alpha-2 code, alpha-3 code, and calling code and write them to columns E, F, and G.

What You Get

  • Column E: ISO-3166 alpha-2 code per row.
  • Column F: ISO-3166 alpha-3 code.
  • Column G: international calling code.
  • Rows where Interzoid could not resolve the country value flagged in a status column.

What If the Data Is Not Quite Ready

Column D has a mix of country names and ISO codes — some rows are already clean

For each value in column D, first check if it's already a valid ISO-3166 alpha-2 code. If so, write it to column E unchanged. If not, call Interzoid to resolve it and write the alpha-2 code to column E. Flag unresolvable values in column F.

You also need currency symbols for the downstream schema

Standardize the country names in column A using Interzoid and write the canonical country name, ISO-2 code, and currency symbol to columns B, C, and D.

Some rows have blank country fields

Skip rows where column D is blank. For all other rows, call Interzoid to resolve and write ISO-2 and ISO-3 codes to columns E and F. Flag blank rows as 'MISSING' in column E.

Full ETL prep pass in one shot

For each value in column D: skip blanks (flag as 'MISSING' in column E), check if already a valid ISO-2 code, otherwise call Interzoid. Write ISO-2 to column E, ISO-3 to column F, calling code to column G, currency symbol to column H. Flag unresolvable values as 'UNRESOLVED.' Create a 'LoadReady' worksheet with only rows where column E is a valid 2-letter code.

The ETL job runs clean. The 2 AM alert doesn't fire.

Try It

Get the 7-day free trial of SheetXAI and open your customer workbook — ask SheetXAI to resolve and standardize column D to ISO-3166 codes before tonight's load. Then see the spoke on converting a multi-currency expense report to USD, or the full Interzoid integration overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more