+ Reply to Thread
Results 1 to 8 of 8

Find last space from the right of text

  1. #1
    Michael
    Guest

    Find last space from the right of text

    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. #2
    Dave O
    Guest

    Re: Find last space from the right of text

    Check out MID(), FIND(), SEARCH(), and RIGHT() functions. Can you
    provide an example or two of your data?


  3. #3
    Myrna Larson
    Guest

    Re: 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"
    <[email protected]> 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



  4. #4
    Michael
    Guest

    Re: Find last space from the right of text

    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"
    > <[email protected]> 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

    >
    >


  5. #5
    Don Guillett
    Guest

    Re: Find last space from the right of text

    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
    [email protected]
    "Michael" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




  6. #6
    Ron Rosenfeld
    Guest

    Re: Find last space from the right of text

    On Mon, 24 Jan 2005 09:49:02 -0800, "Michael"
    <[email protected]> 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

  7. #7
    gennario
    Guest

    Re: Find last space from the right of text

    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"
    > <[email protected]> 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
    >


  8. #8
    Don Guillett
    Guest

    Re: Find last space from the right of text

    Think about it and you will be able to come up with the answer yourself.
    Best to keep responses in the ORIGINAL thread for continuity.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "gennario" <[email protected]> wrote in message
    news:[email protected]...
    > 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"
    > > <[email protected]> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1