Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Setup / March 2007

Tip: Looking for answers? Try searching our database.

How to search a string from the right ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EuroMaverick - 28 Mar 2007 20:26 GMT
Hello people,

First time around here. I am not sure I'm on the right newsgroup, so please
redirect me if needed.

Here's my question: I need to be able to search a string from the right in
an Excel-cell. Basically I need to find the last space in a string. I can
find the first space in a string with the find-command but that works only
from left to right. How can I do this from right to left ?

Many thanks,

Mav.
Elkar - 28 Mar 2007 20:56 GMT
You can still use the FIND function, you just need a way to identifiy the
last space.  This can be accomplished by using SUBSTITUTE to replace the last
space with a different character.  For this example, I'll use the tilde ~
character.  Whatever character you use, make sure it is one that would never
occur normally in your data.

=FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))

HTH,
Elkar

> Hello people,
>
[quoted text clipped - 9 lines]
>
> Mav.
EuroMaverick - 28 Mar 2007 21:20 GMT
Hello Elkar,

That worked like a charm !

Many thanks,

Mav.

> You can still use the FIND function, you just need a way to identifiy the
> last space.  This can be accomplished by using SUBSTITUTE to replace the last
[quoted text clipped - 20 lines]
> >
> > Mav.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.