IF LEFT FIND

Status
Not open for further replies.

datastudent

Board Regular
Joined
Sep 7, 2021
Messages
91
Office Version
  1. 365
Platform
  1. Windows
Hi,

I want to extract the name of the country in my set of data. All the names are in the beginning of the set of texts so I tried to use the LEFT and FIND function. However, It does not work on those two words country and those row that only has the country name alone.

Here's where I am right now.

Template_v1.xlsm
BCF
1CountryOutbound Destination
2AlbaniaAlbania FixedAlbania
3AlbaniaAlbania MobileAlbania
5#VALUE!ArgentinaArgentina
6ArgentinaArgentina - MobileArgentina
7#VALUE!ArmeniaArmenia
19Bosnia&HerzegovinaBosnia and HerzegovinaBosnia&Herzegovina
20Bosnia&HerzegovinaBosnia and Herzegovina MobileBosnia&Herzegovina
30CostaCosta RicaCosta Rica
34CyprusCyprus MobileCyprus
35CzechCzech RepublicCzech Republic
36CzechCzech Republic MobileCzech Republic
iBASIS_Outbound
Cell Formulas
RangeFormula
B2:B3,B5:B7,B19:B20,B30,B34:B36B2=IF(OR(C2="Bosnia and Herzegovina",C2="Bosnia and Herzegovina Mobile"),"Bosnia&Herzegovina",LEFT(C2,FIND(" ",C2)-1))
 
May be you can try,
Excel Formula:
=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(C2, " Mobile", ""), " Fixed", ""), "-", ""))
 
Upvote 0
Looks like you want to use an ampersand, and lose the "Republic" based on your sample data. Perhaps:
Book1
ABC
1CountryOutbound Destination
2AlbaniaAlbania Fixed
3AlbaniaAlbania Mobile
4ArgentinaArgentina
5ArgentinaArgentina - Mobile
6ArmeniaArmenia
7Bosnia&HerzegovinaBosnia and Herzegovina
8Bosnia&HerzegovinaBosnia and Herzegovina Mobile
18Costa RicaCosta Rica
22CyprusCyprus Mobile
23CzechCzech Republic
24CzechCzech Republic Mobile
Sheet1
Cell Formulas
RangeFormula
B2:B8,B18,B22:B24B2=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(C2," Fixed","")," - Mobile","")," Mobile","")," and ","&")," Republic","")
 
Upvote 0
Duplicate to post #6 here: Find the Country in a set of words

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,226,837
Messages
6,193,253
Members
453,784
Latest member
Chandni

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