Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 34
Default Extract text from a string

I have the following cells

A1 = Joe Bloggs[20%]
A2 = Fred Astair[5%]

I would like to pull the percentage out of the name into another cell. At
the moment I have

MID(A1,SEARCH("[",A1)+1,3)

However this won't work for a percentage under 10, like 5%.
Also, there are occasions when there is no percentage in brackets, just the
person's name - is there a way of allowing for this without using an extra IF
statement?

Thanks,

Ellebelle
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Extract text from a string

Ellebelle

Well I couldn't manage it without IF statements, will this do?

=IF(LEN(MID(A1,SEARCH("[",A1)+1,3))=1,"",IF(RIGHT(MID(A1,SEARCH("[",A1)+1,3),1)="]",MID(A1,SEARCH("[",A1)+1,2),MID(A1,SEARCH("[",A1)+1,3)))

Mike

"" wrote:

I have the following cells

A1 = Joe Bloggs[20%]
A2 = Fred Astair[5%]

I would like to pull the percentage out of the name into another cell. At
the moment I have

MID(A1,SEARCH("[",A1)+1,3)

However this won't work for a percentage under 10, like 5%.
Also, there are occasions when there is no percentage in brackets, just the
person's name - is there a way of allowing for this without using an extra IF
statement?

Thanks,

Ellebelle

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 20
Default Extract text from a string

Hi,

Try following formula...

=IF(ISERROR(SEARCH("[",A1)),"",SUBSTITUTE(SUBSTITUTE(MID(A1,SEARCH( "[",A1),(LEN(A1)-SEARCH("[",A1))+1),"[",""),"]",""))


--
Haldun Alay



"ellebelle" wrote in message
...
I have the following cells

A1 = Joe Bloggs[20%]
A2 = Fred Astair[5%]

I would like to pull the percentage out of the name into another cell. At
the moment I have

MID(A1,SEARCH("[",A1)+1,3)

However this won't work for a percentage under 10, like 5%.
Also, there are occasions when there is no percentage in brackets, just
the
person's name - is there a way of allowing for this without using an extra
IF
statement?

Thanks,

Ellebelle


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Extract text from a string

Hi Ellebelle

Try
=SUBSTITUTE(MID(A1,SEARCH("[",A1)+1,3),"]","")

--
Regards

Roger Govier


"ellebelle" wrote in message
...
I have the following cells

A1 = Joe Bloggs[20%]
A2 = Fred Astair[5%]

I would like to pull the percentage out of the name into another cell.
At
the moment I have

MID(A1,SEARCH("[",A1)+1,3)

However this won't work for a percentage under 10, like 5%.
Also, there are occasions when there is no percentage in brackets,
just the
person's name - is there a way of allowing for this without using an
extra IF
statement?

Thanks,

Ellebelle



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Extract text from a string

You can use TTC (Text To Columns), Delimited,
With the left square bracket as the delimiter.

After the primary separation, use Edit & Replace to eliminate the right
square bracket.

This gives you actual data, with *no* ensuing formulas to deal with.
--

HTH,

RD
================================================== ===
Please keep all correspondence within the Group, so all may benefit!
================================================== ===

"ellebelle" wrote in message
...
I have the following cells

A1 = Joe Bloggs[20%]
A2 = Fred Astair[5%]

I would like to pull the percentage out of the name into another cell. At
the moment I have

MID(A1,SEARCH("[",A1)+1,3)

However this won't work for a percentage under 10, like 5%.
Also, there are occasions when there is no percentage in brackets, just the
person's name - is there a way of allowing for this without using an extra
IF
statement?

Thanks,

Ellebelle


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I extract part of a text string Brennan Excel Discussion (Misc queries) 2 November 28th 06 07:26 PM
Extract text string using MID Turk Excel Worksheet Functions 5 October 11th 06 06:39 PM
Extract text from String Dan Excel Worksheet Functions 8 July 1st 06 12:39 PM
EXTRACT NUMBERS FROM TEXT STRING fiber_doc Excel Worksheet Functions 4 November 28th 05 06:40 PM
Extract % from text string Mike Excel Worksheet Functions 5 December 1st 04 08:02 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"