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

I'm trying to figure out how to construct a formula to extract certain
information.

The text may look like one of the following:

Safeway Store # 711 - Mill Valley, CA
Jake's Marketplace - Oakland, CA

I am wanting to take the city portion (between the "- " and the "," and put
it in another column. The number of characters will vary and I'm not sure
how to do this. Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Need to extract certain text from text string

With your data in A1, try this formula:

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

Copy down as required.

Hope this helps.

Pete

On Nov 21, 6:45 pm, Trista @ Pacific <Trista @
wrote:
I'm trying to figure out how to construct a formula to extract certain
information.

The text may look like one of the following:

Safeway Store # 711 - Mill Valley, CA
Jake's Marketplace - Oakland, CA

I am wanting to take the city portion (between the "- " and the "," and put
it in another column. The number of characters will vary and I'm not sure
how to do this. Thanks for any help.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 171
Default Need to extract certain text from text string

With the input string in A1:
=TRIM(MID(A1,FIND("-",A1)+1,(FIND(",",A1,FIND("-",A1)))-FIND("-",A1)-1))
This is looking for the comma, then the dash after the comma.
It returns the characters between the two, with any leading or trailing
space characters trimmed off.


"Trista @ Pacific" wrote:

I'm trying to figure out how to construct a formula to extract certain
information.

The text may look like one of the following:

Safeway Store # 711 - Mill Valley, CA
Jake's Marketplace - Oakland, CA

I am wanting to take the city portion (between the "- " and the "," and put
it in another column. The number of characters will vary and I'm not sure
how to do this. Thanks for any help.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Need to extract certain text from text string

Try this.

Assuming the state is *always* the 2 letter abbreviation.

=MID(A1,FIND("-",A1)+2,LEN(MID(A1,FIND("-",A1)+2,255))-4)

--
Biff
Microsoft Excel MVP


"Trista @ Pacific" <Trista @ wrote in
message ...
I'm trying to figure out how to construct a formula to extract certain
information.

The text may look like one of the following:

Safeway Store # 711 - Mill Valley, CA
Jake's Marketplace - Oakland, CA

I am wanting to take the city portion (between the "- " and the "," and
put
it in another column. The number of characters will vary and I'm not sure
how to do this. Thanks for any help.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Awesome, thank you!

Thanks!

"bpeltzer" wrote:

With the input string in A1:
=TRIM(MID(A1,FIND("-",A1)+1,(FIND(",",A1,FIND("-",A1)))-FIND("-",A1)-1))
This is looking for the comma, then the dash after the comma.
It returns the characters between the two, with any leading or trailing
space characters trimmed off.


"Trista @ Pacific" wrote:

I'm trying to figure out how to construct a formula to extract certain
information.

The text may look like one of the following:

Safeway Store # 711 - Mill Valley, CA
Jake's Marketplace - Oakland, CA

I am wanting to take the city portion (between the "- " and the "," and put
it in another column. The number of characters will vary and I'm not sure
how to do this. Thanks for any help.

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
extract text from string AskExcel Excel Worksheet Functions 2 October 9th 07 06:54 AM
Extract text from a string ellebelle Excel Worksheet Functions 4 June 13th 07 04:25 PM
Extract text string using MID Turk Excel Worksheet Functions 5 October 11th 06 06:39 PM
EXTRACT TEXT FROM TEXT STRING carricka Excel Worksheet Functions 4 July 8th 05 11:00 AM
Extract % from text string Mike Excel Worksheet Functions 5 December 1st 04 08:02 PM


All times are GMT +1. The time now is 12:50 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"