Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 2
Default How to search a string from the right ?

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.
  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 964
Default How to search a string from the right ?

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


"EuroMaverick" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 2
Default How to search a string from the right ?

Hello Elkar,

That worked like a charm !

Many thanks,

Mav.

"Elkar" wrote:

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


"EuroMaverick" wrote:

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
SUMPRODUCT and search string peacelittleone Excel Worksheet Functions 5 June 15th 05 03:24 PM
Q: search in string JIM.H. Excel Discussion (Misc queries) 5 January 5th 05 10:24 PM
Segregating a Search String RTP Excel Discussion (Misc queries) 1 December 22nd 04 07:04 PM
Newbie: How to search a text string from right Frank Krogh Excel Worksheet Functions 5 November 26th 04 07:16 PM


All times are GMT +1. The time now is 06:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"