+ Reply to Thread
Results 1 to 5 of 5

Sort Data Using the Last Character As the Primary Sort Character

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    Oregon
    MS-Off Ver
    Excel 2003
    Posts
    12

    Sort Data Using the Last Character As the Primary Sort Character

    I have data that I want to sort and the column I want to sort by is a list of part numbers. Some of these part numbers end with an "s" and I want to group all those part numbers together. Since the "s" is at the end of those part numbers, I don't know how to sort those. Can I set by the last character in a cell?

    Or, can I reverse the contents in a cell so that the "s" would be at the beginning?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,886

    Re: Sort Data Using the Last Character As the Primary Sort Character

    A couple of questions. Are the part numbers all the same length? Do all the part numbers have an alpha character at the end?

    Can you provide a sample of what the part numbers may look like?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Sort Data Using the Last Character As the Primary Sort Character

    perhaps use a helper column?
    =if(right(A1,1)="S",0,1)
    then sort on the helper 1st, and then by whatever else you sorted?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    08-22-2011
    Location
    Oregon
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Sort Data Using the Last Character As the Primary Sort Character

    Quote Originally Posted by FDibbins View Post
    perhaps use a helper column?
    =if(right(A1,1)="S",0,1)
    then sort on the helper 1st, and then by whatever else you sorted?
    That worked, thanks.

    alansidman, to answer your question all the part numbers are not the same length

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Sort Data Using the Last Character As the Primary Sort Character

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Need to sort by 7th character in column H (?)
    By DataGirl22 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2013, 12:19 PM
  2. Sort by 9th Character
    By adinnin in forum Excel General
    Replies: 2
    Last Post: 09-05-2011, 09:33 AM
  3. sort list by last character
    By rushdenx1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-24-2007, 03:04 PM
  4. sort by character
    By TORINO7 in forum Excel General
    Replies: 2
    Last Post: 06-10-2007, 09:36 PM
  5. Character sort order ?
    By Bruce Sinclair in forum Excel General
    Replies: 10
    Last Post: 02-20-2006, 07:15 PM

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