Extract Text Outside of Brackets

W

willik

I want to extract all text inside a cell except for what is in brackets
[ DO NOT DELETE THIS TEXT WITHIN BRACKETS ] as shown here.

I am experimenting with functions like

=MID(A3,FIND("[",A3,1),100)

This returns

[ DO NOT DELETE THIS TEXT WITHIN BRACKETS ] as shown here.

but does not extract the "as shown here". I have many variations of
text within brackets, so the function has to detemine the length with
respect to the brackets.

Any help will be appreciated. Thank you.
 
F

Frank Kabel

Hi
if you have only one textpart within brackets for each cell you may try
=LEFT(A1,FIND("[",A1)-1) & MID(A1,FIND("]",A1)+1,1024)
to get everything except the bracket text part
use
=MID(A1,FIND("[",A1),FIND("]",A1)-FIND("[",A1)+1)
to get the text within brackets

Frank
 
P

Peo Sjoblom

This will extract what's in the brackets

=TRIM(LEFT(MID(A1,FIND("[",A1)+1,255),FIND("]",MID(A1,FIND("[",A1)+1,255))-1
))

if you want what's outside of the brackets

=SUBSTITUTE(A1,LEFT(MID(A1,FIND("[",A1),255),FIND("]",MID(A1,FIND("[",A1)+1,
255))+1),"")
 
W

willik

To: Frank Kabel & Peo Sjoblom

WOW ! Both of these solutions work great.

Thank you for the help.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top