Pharsing string from the right to the first space
As a worksheet formula:
=MID(A1,1+FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),
LEN(A1)-LEN(SUBSTITUTE(A1," ","")))),255)
One difference between the two is, as written, the worksheet function will
return an error message if there is only one word, whereas the UDF will
return
that word.
Not sure what you want to do if there is only a single word, but these
behaviors are easily modified, depending on your requirements.
You can make the worksheet formula do the same by adding a blank space in
front of the A1 references...
=MID(" "&A1,1+FIND(CHAR(1),SUBSTITUTE(" "&A1," ",
CHAR(1),LEN(" "&A1)-LEN(SUBSTITUTE(" "&A1," ","")))),255)
I'm pretty sure your last paragraph indicates you know this, but I figured I
would post the message for those reading this thread in the archives.
Rick
|