View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 698
Default How to extract right-most word?

Try one of these:

Array formula (committed with Ctrl+Shift+Enter, instead of just Enter):
=TRIM(VLOOKUP(" *",RIGHT(A1,ROW($A$1:INDEX($A:$A,LEN(A1),1))),1,0) )

or this regular formula (committed with just Enter)
=TRIM(VLOOKUP(" *",INDEX(RIGHT(A1,ROW($A$1:INDEX($A:$A,LEN(A1),1)) ),0),1,0))

or this regular formula
=MID(A1,FIND("|",SUBSTITUTE(A1," ","|",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

How can I extract the right-most "word" from a cell without knowing
its length, how many words are in the cell, or what the word is and
how many times it might occur in the cell?

I define a "word" to be a string of characters delimited by blanks.
To keep things simple, assume that there is always at least one blank
to the left of the last word.

For example, if A1 contains "now is the time", I want a formula in B1
whose result is "time".

I would be content with the following paradigm (which does not work):

=right(A1, len(A1) - find(A1, " ", -len(A1))

In other words, I want a use of FIND() or other function that searches
from the right instead of the left. (Specifying a negative starting
position might be one way to design it, in theory.)

The following paradigm is __not__ acceptable for my purposes, even
though it works in this particular example:

=right(A1, len(A1) - find(A1, "time") + 1)

"It cannot be done otherwise" is an acceptable, albeit undesirable
answer.