+ Reply to Thread
Results 1 to 4 of 4

Sorting column by last word (name)

  1. #1
    Registered User
    Join Date
    08-22-2008
    Location
    New Zealand
    Posts
    10

    Sorting column by last word (name)

    Hi all

    I have a column of names generated by my accounting program (Quickbooks), but the way Quickbook works means the names are sorted on their first entry which is usually the given name. Sometimes the names are husband and wife, and sometimes they may have two words making up their surname. Complicated!

    I want to sort by surname - how could I do that?

    e.g.

    Jacqui Knight
    Tom & Jerry Cat
    Leonard da Vinci


    Jacqui

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2008
    Location
    singapore
    Posts
    626
    this code only for your reference.
    I think your data is too complicated to solve

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565
    Hi there,

    Put the following formula (assuming the data starts at row 2 - change as required) in the first available blank column next your data fill down as necessary and then sort the entire data range by it. You can then delete the column if you wish:

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

    Note this formula was created by "Datsmart" from this thread.

    HTH

    Robert
    Last edited by Trebor76; 09-09-2008 at 12:50 AM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    how does that formula deal with da vinci which is a surname but with a gap in it?, the code only returns vinci
    Last edited by martindwilson; 09-09-2008 at 04:33 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro Question: Copy a word from a column to another automaticly
    By zaptiri in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-11-2008, 10:00 PM
  2. Macro for coding an action based on 3 columns of information
    By chozen86 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-31-2008, 10:44 PM
  3. Replies: 7
    Last Post: 05-28-2008, 03:12 AM
  4. VBA; find string and copy
    By Bill Rudd in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-06-2008, 10:41 PM
  5. Column Sorting
    By grahammal in forum Excel General
    Replies: 1
    Last Post: 09-13-2006, 10:20 AM

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