Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Myrna Larson
 
Posts: n/a
Default Find last space from the right of text

=MID(SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)

On Mon, 24 Jan 2005 09:49:02 -0800, "Michael"
wrote:

I need to find the last space from the right of text in a cell and then
return the text that is to the right of that last space.

Any help is greatly appreciated.

Thanks


  #2   Report Post  
Michael
 
Posts: n/a
Default

Thanks to both of you for posting suggestions and answers. This was very
helpful.

"Myrna Larson" wrote:

=MID(SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))),FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)

On Mon, 24 Jan 2005 09:49:02 -0800, "Michael"
wrote:

I need to find the last space from the right of text in a cell and then
return the text that is to the right of that last space.

Any help is greatly appreciated.

Thanks



  #3   Report Post  
Don Guillett
 
Posts: n/a
Default

Put this function in a REGULAR module and then =fls(d10) will work.
Function FLS(X)
FLS = Right(X, Len(X) - InStrRev(X, " "))
End Function

A macro to do that for the active cell.
Sub FLSS()
MsgBox Right(ActiveCell, Len(ActiveCell) - InStrRev(ActiveCell, " "))
End Sub
=====
if your version does not have instrev then use this

Function InStrRev(Strng As String, Char As String) As Integer
Dim Lngth As Integer, i As Integer
Lngth = Len(Strng)
For i = Lngth To 1 Step -1
If Mid(Strng, i, 1) = Char Then
InStrRev = i
Exit Function
End If
Next i
End Function
'Howard Groves cmmroom@ ddre.detroitdiesel.com
=========

--
Don Guillett
SalesAid Software

"Michael" wrote in message
...
I need to find the last space from the right of text in a cell and then
return the text that is to the right of that last space.

Any help is greatly appreciated.

Thanks



  #4   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 24 Jan 2005 09:49:02 -0800, "Michael"
wrote:

I need to find the last space from the right of text in a cell and then
return the text that is to the right of that last space.

Any help is greatly appreciated.

Thanks



Assuming that there are no tilde's in your original text:

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

will do what you describe.


--ron
  #5   Report Post  
gennario
 
Posts: n/a
Default

Ron,

Your resonse on this was perfect for what I am looking for. Is there also a
way to return the data BEFORE (or the left) of the space?

"Ron Rosenfeld" wrote:

On Mon, 24 Jan 2005 09:49:02 -0800, "Michael"
wrote:

I need to find the last space from the right of text in a cell and then
return the text that is to the right of that last space.

Any help is greatly appreciated.

Thanks



Assuming that there are no tilde's in your original text:

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

will do what you describe.


--ron



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
how to find replace text or symbol with carriage return jo New Users to Excel 11 April 4th 23 10:41 AM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
how to hyperlink text to a cell steve New Users to Excel 1 December 14th 04 08:21 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM


All times are GMT +1. The time now is 05:24 PM.

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

About Us

"It's about Microsoft Excel"