need a formula to to find names of countries

mukhtarhi

New Member
Joined
Mar 26, 2013
Messages
10
Hi,

Can someone guide with a formula, just want to identify name of a country present in a line in a cell, for eg there is an address "1023 building road, street kingkong, Nepal" i have thousands lines like these in a column, need a formula which should give return value as "Nepal" since its the name of country, similarly there are different names of countries like Sri Lanka , China etc.

Kindly someone help.
Thanks.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

Can someone guide with a formula, just want to identify name of a country present in a line in a cell, for eg there is an address "1023 building road, street kingkong, Nepal" i have thousands lines like these in a column, need a formula which should give return value as "Nepal" since its the name of country, similarly there are different names of countries like Sri Lanka , China etc.

Kindly someone help.
Thanks.

Is the country always after the last comma?

Do you have a pre-set list of countries you are looking for?
 
Upvote 0
In A1 cell
1023 building road, street kingkong, Nepal

<colgroup> </colgroup><tbody>
</tbody>
In B1 cell
Code:
=TRIM(MID(A1,FIND("^",SUBSTITUTE(A1,",","^",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))))+1,255))

To Mask Error
Code:
=IFERROR(TRIM(MID(A1,FIND("^",SUBSTITUTE(A1,",","^",LEN(A1)-LEN(SUBSTITUTE(A1,",",""))))+1,255)),"")
 
Upvote 0
hi @Aladin Akyurek - it can any country in the world this is all i want to say, and not necessary there will be a comma .

  • Thanks.
    user-offline.png
 
Upvote 0
hi @Aladin Akyurek - it can any country in the world this is all i want to say, and not necessary there will be a comma .

  • Thanks.
    user-offline.png

it can be any country in the world and not necessary seperated with a comma.
Thanks.

Assume that the country is the last bit in the string, preceeded by a space:

=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)))

where A2 houses a string of interest.

If this does not suffice, try to find a table of country names on internet and invoke:

=LOOKUP(9.99999999999999E+307,SEARCH(COUNTRIES,A2),CCOUNTRIES)

where COUNTRIES stands for the the range housing the country names.
 
Upvote 0
@ Aladin (=LOOKUP(9.99999999999999E+307,SEARCH(COUNTRIES,A2),CCOUNTRIES)

this formula works, Awsome ! iam extremely greatfull to you ! Cheers .
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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