+ Reply to Thread
Results 1 to 5 of 5

sort names

  1. #1
    Tee
    Guest

    sort names

    Please help I have a very long list of names all typed in one cell ie:

    Miss L Rayner
    Mr J C F Clark
    Mr P R Brown
    Mr D L P Race
    Ms Peal

    I need to sort this list by the last name.

    I can sort this via Data > Text to columns, but this give the surname in
    either column 3, 4 or 5... is there anyway to overcome this and sort all
    those after the last space?

  2. #2
    Stefi
    Guest

    RE: sort names


    Assume the names are in column A, with an UDF:

    =MID(A1,FindRev(A1," ")+1,255)

    Public Function FindRev(StrtoSearch As String, StrSearchedFor As String) As
    Long
    FindRev = 0
    On Error Resume Next
    FindRev = InStrRev(StrtoSearch, StrSearchedFor)
    End Function

    Regards,
    Stefi

    „Tee” ezt *rta:

    > Please help I have a very long list of names all typed in one cell ie:
    >
    > Miss L Rayner
    > Mr J C F Clark
    > Mr P R Brown
    > Mr D L P Race
    > Ms Peal
    >
    > I need to sort this list by the last name.
    >
    > I can sort this via Data > Text to columns, but this give the surname in
    > either column 3, 4 or 5... is there anyway to overcome this and sort all
    > those after the last space?


  3. #3
    Bob Phillips
    Guest

    Re: sort names

    Use this formula to get the last name in a separate column

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

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Tee" <[email protected]> wrote in message
    news:[email protected]...
    > Please help I have a very long list of names all typed in one cell ie:
    >
    > Miss L Rayner
    > Mr J C F Clark
    > Mr P R Brown
    > Mr D L P Race
    > Ms Peal
    >
    > I need to sort this list by the last name.
    >
    > I can sort this via Data > Text to columns, but this give the surname in
    > either column 3, 4 or 5... is there anyway to overcome this and sort all
    > those after the last space?




  4. #4
    Jef Gorbach
    Guest

    Re: sort names

    select the name column then \Data\Text to Columns delimited by space to
    blank columns (splits into the various parts) then Data\Sort on last name.
    Remove the no-longer needed columns, but might consider keeping the last
    name as a hidden column for future resorting.

    "Tee" <[email protected]> wrote in message
    news:[email protected]...
    > Please help I have a very long list of names all typed in one cell ie:
    >
    > Miss L Rayner
    > Mr J C F Clark
    > Mr P R Brown
    > Mr D L P Race
    > Ms Peal
    >
    > I need to sort this list by the last name.
    >
    > I can sort this via Data > Text to columns, but this give the surname in
    > either column 3, 4 or 5... is there anyway to overcome this and sort all
    > those after the last space?




  5. #5
    Stefi
    Guest

    Re: sort names

    Tricky, I like it! But Microsoft should make things easier by introducing VB
    InStrRev as a worksheet function!

    Regards,
    Stefi


    „Bob Phillips” ezt *rta:

    > Use this formula to get the last name in a separate column
    >
    > =RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
    > ","")))))
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Tee" <[email protected]> wrote in message
    > news:[email protected]...
    > > Please help I have a very long list of names all typed in one cell ie:
    > >
    > > Miss L Rayner
    > > Mr J C F Clark
    > > Mr P R Brown
    > > Mr D L P Race
    > > Ms Peal
    > >
    > > I need to sort this list by the last name.
    > >
    > > I can sort this via Data > Text to columns, but this give the surname in
    > > either column 3, 4 or 5... is there anyway to overcome this and sort all
    > > those after the last space?

    >
    >
    >


+ 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