+ Reply to Thread
Results 1 to 7 of 7

Sorting a column with dashes, numbers and characters!!

  1. #1
    Registered User
    Join Date
    03-29-2020
    Location
    Canton, Ohio
    MS-Off Ver
    2016
    Posts
    7

    Sorting a column with dashes, numbers and characters!!

    How do I sort a file that has two columns A & B.

    This file will be used to print labels for a racking system in our warehouse. We will use a different colored label for the printed barcode depending on the level. ( For example Level one will be printed on white labels, Level two will be printed on yellow labels.)


    Column A is the Location ID # and Column B is the Location Name, the two are link to each other.


    Location Name A-00-L1

    (A) is the physical row in the warehouse,
    (00) is a location in that row
    (L1) is the level in that location.


    I need the data to be sorted by the 2nd column as seen below!

    Current

    40380 - A-00-L1
    41105 - A-00-L2
    41160 - A-00-L3
    41216 - A-00-L4
    41271 - A-00-L5
    40381 - A-01-L1
    41106 - A-01-L2
    41161 - A-01-L3
    41217 - A-01-L4
    41272 - A-01-L5
    40382 - A-02-L1
    41107 - A-02-L2
    41162 - A-02-L3
    41218 - A-02-L4
    41273 - A-02-L5

    How I want it sorted

    40380 - A-00-L1
    40381 - A-01-L1
    40382 - A-02-L1
    41105 - A-00-L2
    41106 - A-01-L2
    41107 - A-02-L2
    41160 - A-00-L3
    41161 - A-01-L3
    41162 - A-02-L3
    41216 - A-00-L4
    41217 - A-01-L4
    41218 - A-02-L4
    41271 - A-00-L5
    41272 - A-01-L5
    41273 - A-02-L5



    Thank you,
    Amos
    Last edited by AmosA; 08-13-2020 at 03:08 PM. Reason: Columns got merged together

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting a column with dashes, numbers and characters!!

    Select the total range.

    Then sort on column A and after that sort on column B.

    If this is not what you want, post an small excel file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  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,939

    Re: Sorting a column with dashes, numbers and characters!!

    Select the range
    go to Data/Sort and Filter/use the box option
    Sort by Col A
    Add Level
    Sort by Col B
    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
    03-29-2020
    Location
    Canton, Ohio
    MS-Off Ver
    2016
    Posts
    7

    Re: Sorting a column with dashes, numbers and characters!!

    This only works if the data in column A is in sequential order but my data is not. Any other ideas?

    Thanks,
    AA

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sorting a column with dashes, numbers and characters!!

    See my comment in #2.

    If this is not what you want, post an small excel file.

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Sorting a column with dashes, numbers and characters!!

    Split your "Location name" (col-B) into three subfields, each in their own column
    Col-C will contain A, B, C etc,
    Col-D will contain 0, 1, 2 etc,
    Col-E will contain L1, L2, L3 etc,

    AmosA.png

    Now you can sort on col-C, then by c0l-E, then by col-D. This gets you the sort order you want.

    Formulas - assuming fixed widths for the three subfields:
    Col-C assuming a start in row-2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

    Col-E
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Sorting a column with dashes, numbers and characters!!

    Or, you could select column B and use Text to Columns to get columns C, D and E.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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: 5
    Last Post: 03-06-2013, 09:02 PM
  2. Remove repeating characters (like dashes in a MAC address value)
    By abromirski in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 05-30-2012, 01:57 AM
  3. Replies: 3
    Last Post: 10-05-2011, 01:45 PM
  4. sorting numbers with letters and dashes
    By IcantdoIt in forum Excel General
    Replies: 5
    Last Post: 08-21-2008, 09:57 AM
  5. Replies: 1
    Last Post: 05-14-2008, 07:55 PM
  6. Replies: 2
    Last Post: 06-23-2006, 02:00 PM
  7. [SOLVED] Convert phone numbers with dashes in them to just numbers
    By J H in forum Excel General
    Replies: 2
    Last Post: 06-22-2006, 09:45 PM
  8. [SOLVED] Is there a way to insert dashes in a column of numbers
    By Mickie in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 05-27-2006, 10:10 AM

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