Strip Extra text

miztiik

New Member
Joined
Jul 4, 2007
Messages
20
i have a data like shown below
Code:
Cell - A1
abc(Sometext_or_number)
def(Sometext_or_number)
ghi(Sometext_or_number)
jkl(Sometext_or_number)
mno(Sometext_or_number)
pqr(Sometext_or_number)

When i run a macro i want only this part
Code:
abc
def
ghi
jkl
mno
pqr
There will always be an opening brace and an closing after the initial text.

Thanks in advance
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Select the Data Range --> Excel menu --> Data - Text to Columns - Delimited - Check "Other" in Delimiters option in the window. Put "(" (without quotes) in the box. Click Finish.

You can also record a macro for these steps !

Repeat the same steps if you want to clean the data with a ")".

Select the Data Range and then put ")" (without quotes) in the box. Click Finish.
 
Upvote 0
Does it have to be a macro:

Formula in B1 filled down:

=MID(A1,1,3)
 
Upvote 0
Hi
the simplest would be B1= left(A1,3) and double click the autofill handle (Plus sign) on bottom right hand corner of the cell to fill till the end of data.
Paste the following codes in the macro window ( Alt F11)

Code:
x = cells(rows.count,1).end(xlUP).row
for a = 1 to x
b= cells(a,1)
cells(a,2) = left(b,3)
next a
if more than three characters can exist before the bracket then replace line 4 with
c= instr(b,"(")
cells(a,2) = left(b,c-1)
Ravi
 
Upvote 0
Another non-macro possibility...

1. Select the column by clicking its heading label.
2. Edit | Replace... | Find what: (* | Repalce with: leave blank | Replace All
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,380
Members
448,955
Latest member
BatCoder

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