+ Reply to Thread
Results 1 to 5 of 5

Trouble with Excel sort functions after trying many different things

Hybrid View

  1. #1
    Registered User
    Join Date
    06-09-2016
    Location
    Denver, CO
    MS-Off Ver
    Office 2010
    Posts
    2

    Trouble with Excel sort functions after trying many different things

    Hey everybody, first post here. I've looked at many different forums for a fix to my problems and I've tried a few different formulas and codes but can't seem to get Excel to sort the way I need to. I have a large list (1,013 rows) of steel shapes for construction purposes that, for example, look like this:

    C3X6
    C6X105
    C7X1225
    C7X98
    W14X30
    W14X311
    W14X34

    Ideally, Excel sorts these to look like:

    C3X6
    C6X105
    C7X98
    C7X105
    C7X1225
    W14X30
    W14X34
    W14X311

    Where the shapes are sorted first by letter, then by the first number, then by the number after the X.

    It's almost as if Excel thinks there's a decimal point in a strange spot and decides that "311" is between "30" and "34". Does anybody know how to work with this and sort to the order that I've specified? Help would be appreciated, thanks everybody!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: Trouble with Excel sort functions after trying many different things

    It's sorting alphabetically from left to right, standard thing on computers.
    So

    1
    3
    24

    when sorted will be produce

    1
    24
    3

    I can't see you've specified a sort order.
    You've stated a list and what it looks like and how Excel sorts that list but you havent stated how you want the list sorted.
    Please explain further.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    06-09-2016
    Location
    Denver, CO
    MS-Off Ver
    Office 2010
    Posts
    2
    Quote Originally Posted by Special-K View Post
    It's sorting alphabetically from left to right, standard thing on computers.
    So

    1
    3
    24

    when sorted will be produce

    1
    24
    3

    I can't see you've specified a sort order.
    You've stated a list and what it looks like and how Excel sorts that list but you havent stated how you want the list sorted.
    Please explain further.
    Sorry, I should've been more clear. The first list in my original post is what I get when I use the "Sort" function. When I said "ideally excel sorts like this" for the second list, that is what I want to achieve.

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: Trouble with Excel sort functions after trying many different things

    With your data in A
    in column B
    =LEFT(A1,FIND("X",A1)-1)&RIGHT("000"&RIGHT(A1,LEN(A1)-FIND("X",A1)),4)
    and copy down the column

    Sort on column B

    P.S. Your second list has the value C7X105 which does not appear on the first list

  5. #5
    Forum Contributor
    Join Date
    04-07-2009
    Location
    Rowley
    MS-Off Ver
    Excel 2007
    Posts
    326

    Re: Trouble with Excel sort functions after trying many different things

    I believe that the COUNTIF() function will work also.

    In cell B1 enter the formula: =COUNTIF($A$1:$A$8,"<="&A1)
    then drag down.

    Sort on column B

    Pretty sure that will get you what your looking for.

+ 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. [SOLVED] Sort macro doing squirley things to my spreadsheet!
    By amoraali in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2015, 05:37 PM
  2. [SOLVED] having trouble with if functions
    By dsm63 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-23-2013, 08:15 PM
  3. Trouble with four key Sort Routine - Excel 2007
    By Orada in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2012, 10:35 AM
  4. Replies: 6
    Last Post: 08-16-2011, 10:47 PM
  5. moving data onto row/ column chart i boxed and sort and rank things?
    By vjachim in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-06-2011, 04:00 PM
  6. Sort data in excel using excel functions
    By krishnapunekar in forum Excel General
    Replies: 2
    Last Post: 07-03-2010, 08:39 AM
  7. How to easily sort things
    By chojje in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 06-14-2007, 08:50 AM

Tags for this Thread

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