Convert country name to country code

Is there a formula to do the contrary of TOCOUNTRY()? Link to formula documentation

I have the country names, but need the 2-digit country codes.

Solved Solved
0 1 375
1 ACCEPTED SOLUTION

Hi there,

as far as I know, it is not possible to do it in the opposite way. Probably you need to create a customer dimension like this:

CASE
WHEN ${country_field} = "United States" THEN "US"
WHEN ${country_field} = "Canada" THEN "CA"
WHEN ${country_field} = "United Kingdom" THEN "GB"
WHEN ${country_field} = "France" THEN "FR"
WHEN ${country_field} = "Germany" THEN "DE"
-- etc
ELSE "Unknown"
END

 

Kind regards,
Krassi

View solution in original post

1 REPLY 1

Hi there,

as far as I know, it is not possible to do it in the opposite way. Probably you need to create a customer dimension like this:

CASE
WHEN ${country_field} = "United States" THEN "US"
WHEN ${country_field} = "Canada" THEN "CA"
WHEN ${country_field} = "United Kingdom" THEN "GB"
WHEN ${country_field} = "France" THEN "FR"
WHEN ${country_field} = "Germany" THEN "DE"
-- etc
ELSE "Unknown"
END

 

Kind regards,
Krassi