+ Reply to Thread
Results 1 to 7 of 7

Sort cells with numbers and text but not alphabetically

  1. #1
    Registered User
    Join Date
    07-23-2021
    Location
    Sydney Australia
    MS-Off Ver
    Office 365
    Posts
    2

    Cool Sort cells with numbers and text but not alphabetically

    I am trying to sort the cells both numerically and letters but not alphabetically. I need to keep the numerical values sorted from low to high but the sizes in the correct order of XS, S, M, L, XL, XXL. I have tried doing a custom list and applying this to the cells but it won't change them. Can anyone help?
    Thanks
    001/223 590-L
    001/223 590-M
    001/223 590-S
    001/223 590-XL
    001/223 590-XS
    001/223 590-XXL
    001/223 999-L
    001/223 999-M
    001/223 999-S
    001/223 999-XL
    001/223 999-XS
    001/223 999-XXL

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Sort cells with numbers and text but not alphabetically

    Welcome to the forum.

    You'd need a helper column 'rank' the sizing letters.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Sort cells with numbers and text but not alphabetically

    B
    C
    D
    2
    001/223 590-L 001/223 400-XS
    3
    001/223 590-M 001/223 400-M
    4
    001/223 590-S 001/223 400-L
    5
    001/223 590-XL 001/223 400-XL
    6
    001/223 590-XS 001/223 590-XS
    7
    001/223 590-XXL 001/223 590-S
    8
    001/223 999-L 001/223 590-M
    9
    001/223 999-M 001/223 590-L
    10
    001/223 999-S 001/223 590-XL
    11
    001/223 999-XL 001/223 590-XXL
    12
    001/223 999-XS 001/223 999-XS
    13
    001/223 999-XXL 001/223 999-S
    14
    001/223 400-XL 001/223 999-M
    15
    001/223 400-XS 001/223 999-L
    16
    001/223 400-L 001/223 999-XL
    17
    001/223 400-M 001/223 999-XXL


    B
    C
    D
    2
    001/223 590-L =LET(
    MyList,$B$2:$B$20,
    letters2numbers,{"XS",1;"S",2;"M",3;"L",4;"XL",5;"XXL",6},
    numbers2letters,{1,"XS";2,"S";3,"M";4,"L";5,"XL";6,"XXL"},
    convertTo, SORT(LEFT(MyList,12)&VLOOKUP(MID(MyList,13,3),letters2numbers,2,0)),
    IFERROR(LEFT(convertTo,12)&VLOOKUP(MID(convertTo,13,3)*1,numbers2letters,2,0),"")
    )
    3
    001/223 590-M 001/223 400-M
    4
    001/223 590-S 001/223 400-L
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Sort cells with numbers and text but not alphabetically

    Bravo! Great use of the LET function. Me likey!!!

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Sort cells with numbers and text but not alphabetically

    Thanks AliGW. I've blushed myself

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,778

    Re: Sort cells with numbers and text but not alphabetically

    The last thing I got this excited about was PowerQuery. LET, for me, is the find of the year so far. I've just started playing with it.

  7. #7
    Registered User
    Join Date
    07-23-2021
    Location
    Sydney Australia
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Sort cells with numbers and text but not alphabetically

    Thanks for this guys I will see if I can do it

+ 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. Replies: 4
    Last Post: 10-20-2020, 04:15 PM
  2. [SOLVED] Looking for a way to sort a range of cells that are text based that contain numbers.
    By scam in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-29-2020, 06:59 AM
  3. Sort Alphabetically whilst updating referenced cells
    By adinnin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-01-2016, 09:24 AM
  4. [SOLVED] Code to sort cells alphabetically
    By mezza89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2014, 08:51 AM
  5. Arranging cells alphabetically with numbers and spacing
    By LastShadow in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-06-2010, 11:03 PM
  6. sort alphabetically and numerically, then sort rows
    By luke20allen in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-01-2008, 07:00 AM
  7. Sort text list alphabetically using a formula
    By paddyyates in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-20-2005, 11: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