Right Function

  • Thread starter Thread starter Irina
  • Start date Start date
I

Irina

Hi guys,

I have to get the last word from text cell.

For example,

Mr. and Mrs. Smith

I need to get Smith. The number of words is changeable.

Thanks a lot in advance,

Irina.
 
Try this:

=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,1024)

This basically replaces all spaces in your text with the ~ tilde character,
except the last one. It then looks for the one remaining space and returns
all text to the right of that. Note that if your text already contains
tildes, then you should use a different symbol.

HTH,
Elkar
 
Elkar said:
Try this:

=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,1024)

This basically replaces all spaces in your text with the ~ tilde character,
except the last one.

Actually, it only replaces the last space with tilde.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top