Question description:
This user has given permission to use the problem statement for this
blog.
I have a column on names (A) and a column of phone numbers (B). Now I want to sort these people by country but the only information I have on their country is the area code in front of the numbers. So I, therefore, have a list of area codes.
I am wondering if I import the area code list onto excel, if and how I could create some sort of formula which would sort them for me. For example, something like "IF contains +33 " but I'd also need the names to stay with their corresponding number.
Hope you can help, thanks
Solved by V. H. in 20 mins
This is the chat thread from the real Excelchat help session. It contains no private user
information.
User
15/09/2017 - 01:28
unfortunately i cannot upload the document as it has confidential information sorry
Excelchat Expert
15/09/2017 - 01:28
Hello, I understand that you need help with sorting your infromation thru their area codes, right?
Excelchat Expert
15/09/2017 - 01:29
That's fine but I hope you understand that this will make it more difficult for both of us to resolve this and thus there won't be any guarantees.
Excelchat Expert
15/09/2017 - 01:29
Anyway, would you be able to provide a few examples so I can analyze and giv you the right solution?
User
15/09/2017 - 01:29
yeah sure
User
15/09/2017 - 01:30
so i have that
Excelchat Expert
15/09/2017 - 01:30
Okay, I noticed that the numbers don't really match. Do you have a different number system?
User
15/09/2017 - 01:30
the 44 is UK and the 33 is france
Excelchat Expert
15/09/2017 - 01:30
Like B2 is 8 numbers long
Excelchat Expert
15/09/2017 - 01:30
I meant B3 is 8, B2 is 9.
User
15/09/2017 - 01:30
then i need on sheet 2 for them to be automatically added the appropriate country
User
15/09/2017 - 01:31
they're just random phone numbers
Excelchat Expert
15/09/2017 - 01:31
But are they using the right format?
Excelchat Expert
15/09/2017 - 01:31
I mean UK really has 9 digits while france only uses 8?
User
15/09/2017 - 01:31
no
Excelchat Expert
15/09/2017 - 01:31
I need this information to provide an accurate formula.
Excelchat Expert
15/09/2017 - 01:31
Otherwise, the formula I'll be giving you may not work correctly for every entry.
User
15/09/2017 - 01:32
now the values are representative
Excelchat Expert
15/09/2017 - 01:32
Okay, thank you for that clarification.
Excelchat Expert
15/09/2017 - 01:32
It seems that we can't use the number of digits as they vary.
Excelchat Expert
15/09/2017 - 01:32
Is it always the first 2 numbers though?
User
15/09/2017 - 01:32
yes just the first 2
Excelchat Expert
15/09/2017 - 01:33
I mean, the first 2 digits are always the area code?
Excelchat Expert
15/09/2017 - 01:33
Okay.
Excelchat Expert
15/09/2017 - 01:33
Entering Explanation Phase
Excelchat Expert
15/09/2017 - 01:33
What we'll do is extract the first 2 digits of each number.
Excelchat Expert
15/09/2017 - 01:33
Then we can simply sort them out using that new helper column.
User
15/09/2017 - 01:34
ok so how is that done?
Excelchat Expert
15/09/2017 - 01:34
Please see the formula I have applied in column C.
Excelchat Expert
15/09/2017 - 01:34
It extracts the first 2 digits of the number.
Excelchat Expert
15/09/2017 - 01:34
That way, you can easily sort them.
User
15/09/2017 - 01:35
ok and then in column D how could i have something like
User
15/09/2017 - 01:35
if value = 44 then write text UK
User
15/09/2017 - 01:35
or if value is 33 write text France
Excelchat Expert
15/09/2017 - 01:35
You will first have to create a reference table.
User
15/09/2017 - 01:35
but i need that for many different codes
Excelchat Expert
15/09/2017 - 01:36
Please be advised that due to our policy we are only allowed to answer 1 question per session but since your question is a simple one, I think I can bend the rules a little so I can still help you with this.
Excelchat Expert
15/09/2017 - 01:36
What we need is a reference table.
User
15/09/2017 - 01:37
thank you
Excelchat Expert
15/09/2017 - 01:37
Please see the formula in column D.
Excelchat Expert
15/09/2017 - 01:38
It is referencing the table in columns G and H.
User
15/09/2017 - 01:38
ok
Excelchat Expert
15/09/2017 - 01:38
You may want to download this sheet to use for your reference.
User
15/09/2017 - 01:39
how do i download
Excelchat Expert
15/09/2017 - 01:39
If you could upload your file I can help you apply the same thing but since it is confidential I'll have to let you apply it on your own. I hope you understand.
Excelchat Expert
15/09/2017 - 01:39
https://docs.google.com/spreadsheets/d/12lB2M7pea39WHrs8NNSmsP1mBKEqMiL1p3FI-DwUq70/edit
Excelchat Expert
15/09/2017 - 01:39
You can download the sheet by going to the link above, clicking FILE > DOWNLOAD AS > Microsoft Excel (.xlsx)
User
15/09/2017 - 01:39
Thank you for your help!
Excelchat Expert
15/09/2017 - 01:40
You are welcome.
Excelchat Expert
15/09/2017 - 01:40
Alright, if you have no other questions regarding the original concern, I'd appreciate a 5-star rating if you think I deserve it. :)
Excelchat Expert
15/09/2017 - 01:40
Please do not forget to click the End Session otherwise I'll be stuck here until the timer expires and be unable to help others. Thank you.
This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user
information.