Extract certain text string from cell

Beh162

Board Regular
Joined
Jan 15, 2015
Messages
132
I have some data that gets pulled in from an import and I'm trying to split the data but I'm running into some confusion

A1
BUF-8(-110)
I need to pull the "BUF" into one cell(b1) and -8 in another (C1)
=Left(A1,3) and it would give me BUF

I ran into a problem when it was 2 characters
NE-2.5(-110)

It will only ever be 2 or 3 characters. The numbers can range from 1 to 5 though

What would be a better approach? Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
If you want to retain the "-" before the number in col C, add: "-"&
before TRIM.
Sheet2



ABC
BUF-8(-110)BUF
NE-2.5(-110)NE

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:83px;"><col style="width:31px;"><col style="width:25px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="align: right"]8[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: right"]2.5[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B1=TRIM(LEFT(SUBSTITUTE(SUBSTITUTE($A1,"(",""),"-",REPT(" ",100)),100))
C1=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1,"(",""),"-",REPT(" ",100)),100,100))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

 
Last edited:
Upvote 0
If there is a dash (minus sign?) always in front of the first number and that first number is always a single digit, then these formulas should also work for you...

B1: =LEFT(A1,FIND("-",A1)-1)

C1: =MID(A1,FIND("(",A1)-1,1)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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