View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Pulling a word from text out of a cell

On Thu, 31 Jan 2008 05:40:01 -0800, Ravens Fan
wrote:

I don't know if this can be done? But, here it goes.

I have a cell that has a line of text in it. I need to be able to search the
text string and look for certain words and copy the word into another cell.

Example:

Cell "R2": runs 1/11, raw material issue

I need to look at that cell and find the words raw material and copy "raw
material" into another cell.

I'll also be looking for other words in the cells to differientate reasoning
for issues.

Words like:

Pail issue, Art Work, etc.

I don't nessarily need to copy the words if that's an issue. I could code
the different words with numbers. So if I'm looking for the words "raw
material", I could code it as equal to "1". If this makes it easier.

Thanks in advance.


Here's one method that will return the desired phrase if it is present in the
source text.

This assumes the source text is less than 256 characters long. If it is
longer, we can certainly rewrite the routine to handle it.

Download and install Longre's free (and easily distributable by embedding in
the workbook) morefunc.xll add-in from:

http://xcell05.free.fr/morefunc/english/index.htm

Set up your list of Phrases to search for in a column (which I NAME'd Phrase).

Then use this formula (with your test sentence in A1):

=REGEX.MID(A1,MCONCAT(Phrases,"|"),,FALSE)
--ron