Extract text before first Space, except formula returns "BR1"

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have text in Col J and have a formula to extract the text before the first space

If the formula returns "BR1", I want the formula amended to extract the data to the left before the last space on the right

i have manually extracted the data in Col L

extract texct based on Name.xlsx
JKL
1BR1 South 985217BR1 BR1 South
2BR1 East 985218BR1 BR1 East
3BT2 HO 987258BT2 BT2
Sheet1
Cell Formulas
RangeFormula
K1:K3K1=IF(LEFT(J1,FIND(" ",J1))="BR1",LEFT(J1,9),(LEFT(J1,FIND(" ",J1))))



It would be appreciated if someone could kindly amend my formula
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
How about
Excel Formula:
=IF(LEFT(J1,3)="br1",LEFT(J1,FIND("^",SUBSTITUTE(J1," ","^",LEN(J1)-LEN(SUBSTITUTE(J1," ",""))))-1),LEFT(J1,FIND(" ",J1)-1))
 
Upvote 0
Word from left is always from 3 letters? then try:
=IF(LEFT(J1,3)="BR1",MID(J1,1,FIND(" ",J1,5)),LEFT(J1,3))
 
Upvote 0
An alternative is to use Power Query which is called Get and Transform Data and located on the Data tab of your version of Excel

Book6
ABCD
1Column1Column1.1Column1.2
2BR1 South 985217BR1South 985217
3BR1 East 985218BR1East 985218
4BT2 HO 987258BT2HO 987258
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, false), {"Column1.1", "Column1.2"})
in
    #"Split Column by Delimiter"
 
Upvote 0
The formula is for the examples given by OP. :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,568
Messages
6,120,272
Members
448,953
Latest member
Dutchie_1

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