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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Stormseed

Banned
Joined
Sep 18, 2006
Messages
3,274
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.
 

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,169
Office Version
  1. 2013
Platform
  1. Windows
Does it have to be a macro:

Formula in B1 filled down:

=MID(A1,1,3)
 

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
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
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
57,446
Office Version
  1. 365
Platform
  1. Windows
Another non-macro possibility...

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

Forum statistics

Threads
1,181,719
Messages
5,931,656
Members
436,797
Latest member
fullmetalpogi

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
Top