+ Reply to Thread
Results 1 to 7 of 7

Sorting numbers and letters

  1. #1
    Registered User
    Join Date
    04-18-2014
    Location
    texas
    MS-Off Ver
    Excel 2003
    Posts
    9

    Sorting numbers and letters

    I have a column that run

    1a
    2a
    3a. etc.


    The problem is when I sort a-z the 10a comes before 1a. Is there a macro to set that. I did the custom sort but it only reaches till 8a going 1a, 1b, 1c and it runs out of space. A
    ny help appreciated

    AUTOINSERTION.xlsx

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help with sorting

    You'll need helper cells to apply a consistent format to your data if you want it to sort consistently.

    With data in column A:

    1) B1: =SUBSTITUTE(A1,LOOKUP(99^99,--MID(A1,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A1&1234567890)),ROW(A$1:INDEX(A:A,LEN($A1))))),"")
    2) C1: =TEXT(LOOKUP(99^99,--MID(A1,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A1&1234567890)),ROW(A$1:INDEX(A:A,LEN($A1))))),"000")&B1
    3) Now highlight all 3 columns
    4) sort by column C
    5) Remove B:C
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-18-2014
    Location
    texas
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Sorting numbers and letters

    I found this macro and modified it but it only changes the column and not rows what would I need to add to change all the rows with included data. Thanks for help

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Sorting numbers and letters

    Hi,

    Can you clarify your comment, "it only changes the column and not rows". I don't understand.
    What exactly are you trying to sort. You're using the .CurrentRegion property anchored on A1. Are you sure there's a contiguous array of values across the columns and down the rows?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting numbers and letters

    If you're going VBA, you can use the method I already gave in post #2 and record that into a macro.

  6. #6
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,324

    Re: Sorting numbers and letters

    Sometimes it is easier to change 1a into 01a
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sorting numbers and letters

    Quote Originally Posted by popipipo View Post
    Sometimes it is easier to change 1a into 01a
    Yes, that's exactly what the instructions in post #2 provide, a consistent number of digits for all the numbers.

+ 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. Sorting column with numbers and letters Excel 2007
    By dark91zc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-06-2013, 02:31 PM
  2. Replies: 3
    Last Post: 01-29-2013, 07:06 PM
  3. Replies: 2
    Last Post: 10-13-2011, 02:35 AM
  4. sorting numbers with letters and dashes
    By IcantdoIt in forum Excel General
    Replies: 5
    Last Post: 08-21-2008, 09:57 AM
  5. [SOLVED] Sorting - cells containing numbers, numbers and letters
    By Gunny in forum Excel General
    Replies: 5
    Last Post: 07-15-2006, 08:30 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