Finding country based on phone numbers

jtklepp

New Member
Joined
Dec 5, 2008
Messages
22
I have a list of mobile phone numbers from various countries. However, I do not know which country each entry is from. Ideally I would like to have a macro that looks at each number, compares to a global list of PSTN structure to determine which part of the phone number is the country code (generally the first 1-3 digits), and then put the country in a separate column.

I am certain all numbers are formatted correctly, so it is only a matter of finding out which part is the country code and putting a value for the country.

Anyone come across this one before?
 
How to extract country codes and country name in excel

Hi, I would like to know how to extract country codes and country name from a list of Phone numbers. The Phone numbers are from different countries and I want to extract the country code and country name.
Country Codes starts from A2 and Country names starts from C2.
Looking for your reply.
Thank you.

Regards,
Adnan
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Re: How to extract country codes and country name in excel

You should have opened new topic.
Could you post an example of your data?
 
Upvote 0
Hi, I would like to know how to extract country codes and country name from a list of Phone numbers. The Phone numbers are from different countries and I want to extract the country code and country name. The Country Codes starts from A2, Country name starts from C2, and Phone numbers starts from G2. Need a formula extract the country code and country name. I'm sorry I do not know Macros. As far as I know we might need to use Nested IF Function and Vlookup Function. Looking forward for your reply.Thank you.
 
Upvote 0
Can you post few examples from each column?
You can download and install two of the following programs:

HTLMaker

or
Excel Jeanie


or when using Internet Explorer just put borders around your data in Excel and copy those cells into your post.
 
Upvote 0
Phone Numbers List
US -15417543010
Singapore - 006585555555
Hongkong - 85215985265
Netherlands - 3107354139
India - 919916906464

Country Code for
1. US - 1
2. Singapore - 65
3. Hongkong- 852
4. Netherlands - 31
5. India - 91

These are some random numbers. Thank you
 
Last edited:
Upvote 0
So in Column G do you have:

US -15417543010
or
15417543010

and column A has country
US

and column C has codes

1
(the layout before you edit post was different)
 
Upvote 0
Do these work?

Code:
[COLOR=#333333]=INDEX($A$2:$A$1000,MATCH(MAX(IF($A$2:$A$1000<>"",(--LEFT(G2,LEN($A$2:$A$1000))=$A$2:$A$1000)*$A$2:$A$1000)),$A$2:$A$1000,0))

[/COLOR][COLOR=#333333]=INDEX($C$2:$C$1000,MATCH(MAX(IF($A$2:$A$1000<>"",(--LEFT(G2,LEN($A$2:$A$1000))=$A$2:$A$1000)*$A$2:$A$1000)),$A$2:$A$1000,0))[/COLOR]
 
Upvote 0
Thank you so much for your time!
I have used the above formula before and its working fine. Can I enter the country code in the formula and which will extract the country code from the number in the next column that is in H2 Column?
 
Last edited:
Upvote 0
Hi,
Can I have a formula which will extract the country code automatically from the phone numbers? I have the country Country code in A2, Country name in C3 and Phone numbers in D2 and I need to enter the formula in G2. We need to check for 4 digit codes first, if no matches then check 3 digit codes, if no check 2 digit code and else check 1 digit code.
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,662
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top