How to retrieve the value within string?

E

Eric

There is a string in cell A1, such as
......... .... (3.25%)
I would like to retrieve the text inside (), which should return 3.25% in
cell B1.
Does anyone have any suggestions on how to retrieve the text within string?
Thanks in advance for any suggestions
Eric
 
M

Mike H

Eric,

Try this which assumes it's the first set of parenthesis in the cell

=MID(A1,FIND("(",A1)+1,FIND(")",A1,FIND("(",A1))-FIND("(",A1)-2)/100
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
M

Mike H

forgot to mention.format as a percentage
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
J

Jacob Skaria

Another way

will handle

.......(3.25%)
------(3.25%)..............

'As text
=REPLACE(MID(A1,FIND("(",A1)+1,255),FIND(")",MID(A1,
FIND("(",A1)+1,255)),255,"")

'As percentage (format the cell)

=--REPLACE(MID(A1,FIND("(",A1)+1,255),FIND(")",MID(A1,
FIND("(",A1)+1,255)),255,"")
 
R

Ron Rosenfeld

There is a string in cell A1, such as
........ .... (3.25%)
I would like to retrieve the text inside (), which should return 3.25% in
cell B1.
Does anyone have any suggestions on how to retrieve the text within string?
Thanks in advance for any suggestions
Eric

Assuming no parenthesis prior to the desired enclosure:

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

--ron
 
R

Ron Rosenfeld

Assuming no parenthesis prior to the desired enclosure:

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

--ron

OH, and if you want to convert the text to a value, as the other respondents
seem to be assuming, you can merely precede the above with a double unary:

=--MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

--ron
 
D

David Biddulph

Note that it needs to be double unary MINUS. Double unary PLUS wouldn't
work.
 
T

T. Valko

Here's another one...

=--SUBSTITUTE(MID(A1,FIND("(",A1)+1,10),")","")

Format as Percentage
 
R

Ron Rosenfeld

Note that it needs to be double unary MINUS. Double unary PLUS wouldn't
work.
--

As in the example I gave.

And I don't believe that Excel ever interprets (or uses) the '+' sign as a
unary operator.
--ron
 
R

Ron Rosenfeld

Here's another one...

=--SUBSTITUTE(MID(A1,FIND("(",A1)+1,10),")","")

Format as Percentage

I believe that requires that the ")" is the last non-space character
--ron
 
R

Ron Rosenfeld

Yes, that's how I interpreted this:

I agree that is consistent with his example, although his textual description
allows for characters after, but does not definitely indicate there could be.

--ron
 

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