Extracting 1st word of a text string delimited by 1 of 2 characters

SG51090

New Member
Joined
Mar 10, 2019
Messages
2
I have strings that I need to pull the first word out of. The problem is, that the first word is either delimited by a space, or an underscore. I have been using the below formula to find the first word if separated by a space, but unclear how to add the OR to look for an underscore.


=IF(ISERR(FIND(" ",A1)),"",LEFT(G10,FIND(" ",A1)-1))

Two exampled of text I would need to pull out:

1. [TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]BigStar Movies - CA - RON - Connected TV / CTV - Video
2. [TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]TubiTV_CA - RON (Telaria)- Connected TV / CTV - Video[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
</tbody>[/TABLE]

In option 1, I would need to pull in BigStar Movies, and in option 2 I would need to pull in TubiTV, so need a formula that will search for either a space OR an underscore.

Thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
How about

Excel 2013/2016
AB
13BigStar Movies - CA - RON - Connected TV / CTV - VideoBigStar
14TubiTV_CA - RON (Telaria)- Connected TV / CTV - VideoTubiTV
Template
Cell Formulas
RangeFormula
B13=LEFT(A13,FIND(" ",SUBSTITUTE(A13,"_"," "))-1)
 
Upvote 0
I have strings that I need to pull the first word out of. The problem is, that the first word is either delimited by a space, or an underscore. I have been using the below formula to find the first word if separated by a space, but unclear how to add the OR to look for an underscore.

Two exampled of text I would need to pull out:

1. [TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]BigStar Movies - CA - RON - Connected TV / CTV - Video
2. [TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]TubiTV_CA - RON (Telaria)- Connected TV / CTV - Video[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
</tbody>[/TABLE]

In option 1, I would need to pull in BigStar Movies, and in option 2 I would need to pull in TubiTV, so need a formula that will search for either a space OR an underscore.

Thanks!

Hi,

Please clarify, for the 1st string, you want the First 2 words, and the 2nd string, you want the First 1 word ??
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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