Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 310
Default Extract text within two specific values within a cell

I have a cell (D2) of wrapped text that contains two keywords: "NAME:" and
"CONSTRAINED". I want to extract all of the text between these two keywords
and paste it in cell L2.
I'm getting closer by using

=MID(D2,SEARCH("NAME:",D2),30)

to get the text that follows the first keyword "NAME:", but I am stuck now
trying to determine how to get the extraction to stop when the query reaches
the second keyword "CONSTRAINED".

Your help would be much appreciated
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Extract text within two specific values within a cell

On Wed, 11 Feb 2009 08:30:03 -0800, Michelle
wrote:

I have a cell (D2) of wrapped text that contains two keywords: "NAME:" and
"CONSTRAINED". I want to extract all of the text between these two keywords
and paste it in cell L2.
I'm getting closer by using

=MID(D2,SEARCH("NAME:",D2),30)

to get the text that follows the first keyword "NAME:", but I am stuck now
trying to determine how to get the extraction to stop when the query reaches
the second keyword "CONSTRAINED".

Your help would be much appreciated


Search for "CONSTRAINED" and subtract from that your initial SEARCH to get the
Number of letters.

Note that your above formula will also extract the word NAME: which is not
'between'.

Something like:

=MID(D2,SEARCH("NAME:",D2)+6,SEARCH("CONSTRAINED", D2)-SEARCH("NAME:",D2)-7)

will obtain the characters between the keywords. You need to also decide what
you want to do about leading/trailing spaces and any included LineFeeds.
--ron
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 a specific portion of text as new cell value Craig860 Excel Discussion (Misc queries) 6 March 20th 08 05:06 PM
Extract specific text NunRacer Excel Worksheet Functions 15 July 30th 07 01:52 AM
Formula to extract a specific word from text string Dinesh Excel Worksheet Functions 4 November 3rd 06 08:35 PM
Extract specific value from a long text string Dinesh Excel Worksheet Functions 4 August 11th 06 04:24 AM
Extract Specific Text mjmoore Excel Worksheet Functions 2 June 2nd 06 08:28 PM


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