+ Reply to Thread
Results 1 to 6 of 6

Sort not ordering product numbers as expected

  1. #1
    Registered User
    Join Date
    01-27-2018
    Location
    York, England
    MS-Off Ver
    2010
    Posts
    2

    Smile Sort not ordering product numbers as expected

    Hi All

    I am trying to sort some data into order, starting at S1000 through to S100145 but when I try it is not doing it the way I want it. They are product numbers. Codes starting S1000 - S1999 are one category, S2000 - S2999 are another and so on. But because it goes up to S10045 it is sorting S1000, S10000, S10005, S1001, S10010, S10015, S1002 and so on. Can anyone tell me what I need to do please.

    Thank you in advance.

    Beth

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #1 requires good titles. I have updated it for you this time because you are a new member. --6StringJazzer
    Last edited by BethC01; 01-27-2018 at 11:58 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort not ordering product numbers as expected

    Welcome to the Forum BethC01!

    Your product numbers start with a letter. That means that they are text strings, not numbers. Text strings are sorted according to their initial characters, so the sort order you see is correct.

    Here is a workaround. Add a column with this formula, assuming your part numbers are in column A:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and copy down. This is the number extracted from your part number. You can use this column as your sort key.

    If this is not clear or you can't get it to work then please attach a file. The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Sort not ordering product numbers as expected

    The numbers you're trying to sort are stored as Text since they begin with a letter. How are you storing your data? Are you using an excel table? Do ALL product numbers begin with a SINGLE letter? In the attached example I tried using the following formula:

    Please Login or Register  to view this content.
    to remove the S at the beginning of the codes. But, because the formula is evaluating values stored as Text it is returning values stored as Text.

    The only solution I can think of is using the Data>Text to Columns tool. You would select all your product codes, make sure you have two empty columns to their right or you're data will be overwritten in those columns. Click the Text to Columns tool in the Data Tab, you want Fixed Width, insert a line just after the S. Click Finish. You will then have a column of the numbers after the "S" that are stored as numbers. Then you can concatenate them back togeather in a table using the =CONCATENATE(column_w_letter,column_w_number) formula.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Sort not ordering product numbers as expected

    I tried 6StringJazzers solution with my mock-up based on your initial post, and it worked perfectly. 6StringJazzers has a the better solution. I was not familiar with the =VALUE or =MID functions.

    I've attached my initial mockup with 6StringJazzers formula in Column C.
    Attached Files Attached Files
    Last edited by jeffreybrown; 01-27-2018 at 12:15 PM. Reason: No need to quote whole posts!

  5. #5
    Registered User
    Join Date
    01-27-2018
    Location
    York, England
    MS-Off Ver
    2010
    Posts
    2

    Re: Sort not ordering product numbers as expected

    Thank you for your help, I will give that a go. Oh and sorry about the title thing

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort not ordering product numbers as expected

    VALUE converts a string to a number.

    MID is a substring function where you can extract part of a string based on the starting character and number of characters. I used 99 to make it gets all the characters; it does not cause an error if this number is bigger than the available characters, it just uses them all.

+ 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. Super Slow Excel
    By graemearthur in forum Excel General
    Replies: 12
    Last Post: 12-23-2015, 03:38 PM
  2. [SOLVED] Need help with an excel file that is super slow and crashes a lot.
    By regorih in forum Excel General
    Replies: 6
    Last Post: 01-14-2014, 07:23 PM
  3. Can anyone help with simplifying this super long Excel IF statement?
    By YPerez in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2013, 05:35 PM
  4. Excel 2007 : IF Super formula
    By Swamp Stomper in forum Excel General
    Replies: 6
    Last Post: 07-30-2012, 07:32 AM
  5. using excel to generate super- bills
    By Seth_1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2012, 08:36 AM
  6. [SOLVED] How can I force Excel to do fractions in super/sub script
    By bigohere in forum Excel General
    Replies: 2
    Last Post: 05-13-2006, 02:40 PM
  7. [SOLVED] Excel should have toolbar buttons which allow subscript and super.
    By citizenwad in forum Excel General
    Replies: 3
    Last Post: 04-21-2005, 11:06 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