How to get First Text from cell?

Mathman

Board Regular
Joined
Jan 28, 2017
Messages
152
Office Version
  1. 2016
Platform
  1. Windows


How can I get the first word from these examples?

[TABLE="width: 314"]
<colgroup><col width="314" style="width: 313.33px;"> </colgroup><tbody>[TR]
[TD="width: 314, bgcolor: transparent, align: left"]Sprint MINI CATEGORIES[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Sprint_to_Fastest MINI CATEGORIES[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Sprint_to_Lowest MINI CATEGORIES[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Sprint_to_Day_Morning MINI CATEGORIES[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: left"]Sprint_to_Late_Night_Weekly MINI CATEGORIES[/TD]
[/TR]
</tbody>[/TABLE]
<strike style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; font-family: sans-serif; font-size: 13px; font-size-adjust: none; font-stretch: 100%; font-style: normal; font-variant: normal; font-weight: 400; line-height: 19.5px; outline-color: transparent; outline-style: none; outline-width: 0px; overflow: visible; width: auto;"></strike>

Assume this example is in cells A1 threw A5
I need to get results in cells B
1 threw B5 and I need them all to = Sprint

Any suggestions?

Thank you
MM
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
There may be a shorter version but this should work. Place this formula in B1 and copy it down to B5:
=IF(ISNUMBER(SEARCH("_",A1))=TRUE,LEFT(A1,FIND("_",A1,1)-1),LEFT(A1,FIND(" ",A1,1)-1))
 
Last edited:
Upvote 0
Hi,

This will also work:


Book1
AB
1Sprint MINI CATEGORIESSprint
2Sprint_to_Fastest MINI CATEGORIESSprint
3Sprint_to_Lowest MINI CATEGORIESSprint
4Sprint_to_Day_Morning MINI CATEGORIESSprint
5Sprint_to_Late_Night_Weekly MINI CATEGORIESSprint
Sheet100
Cell Formulas
RangeFormula
B1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE(A1,"_"," ")," ",REPT(" ",100)),100))


Formula copied down.
 
Upvote 0
Also, formula in Post #2 can be shortened to this:

=IFERROR(LEFT(A1,FIND("_",A1,1)-1),LEFT(A1,FIND(" ",A1,1)-1))
 
Last edited:
Upvote 0
Also, formula in Post #2 can be shortened to this:

=IFERROR(LEFT(A1,FIND("_",A1,1)-1),LEFT(A1,FIND(" ",A1,1)-1))
You can shorten it even further by doing it this way...

=LEFT(A1,IFERROR(FIND("_",A1),FIND(" ",A1))-1)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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