Extract certain text string from cell

Beh162

Board Regular
Joined
Jan 15, 2015
Messages
130
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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
If you want to retain the "-" before the number in col C, add: "-"&
before TRIM.
Sheet2



ABC
1BUF-8(-110)BUF8
2NE-2.5(-110)NE2.5

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:83px;"><col style="width:31px;"><col style="width:25px;"></colgroup><tbody>
</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,216,326
Messages
6,130,054
Members
449,555
Latest member
maXam

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