+ Reply to Thread
Results 1 to 5 of 5

Sorting disregards dash

  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349

    Sorting disregards dash

    This is the result of a sorting that I do - the range is formatted as text:

    756/1-015
    756/1-019
    756/1-020
    756/102-017
    756/102-020
    756/1-031
    756/105-004
    756/105-006
    756/106-002

    I do not want the value 756/1-031 to end in that position as it belongs after 756/1-20, but apparently the sorting procedure disregards the dash.
    Replacing the dash with an underscore can solve the problem, but I would very much like to avoid that solution.
    Is it possible to make Excel respect the dash as a significant element in the string?

    NSV

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,893

    Re: Sorting disregards dash

    You can get that to happen if you change 756/1- to 756/100- for consistency. You can use Find & Replace (CTRL-H) to make those changes.

    If this messes up your established coding system, then copy those codes into another (helper) column, make the changes to the helper, and use the helper within the sort range and as the sort key.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349

    Re: Sorting disregards dash

    Thanks Pete, I already tried the 756/100 solution, but it fouled up some other things, so I had to drop it.
    Currently I use a 2-helper-columns solution where I divide the values at the dash, but I was hoping to get rid of that.

    Does all this mean that the dash does not have a position in the sorting hieararchy?

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,893

    Re: Sorting disregards dash

    It does, but it depends how you have sorted them. If you treat them as text values then it is the ASCII code values of each character that is taken account of, but if you sort them as it they are numbers (which they are NOT), then Excel tries to treat all the characters as digits and does its best to make sense of it.

    At least my second suggestion would mean one less helper column for you.

    Hope this helps.

    If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Pete

  5. #5
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349

    Re: Sorting disregards dash

    "If I treat them as ASCII", but how can I do that?

    Anyway, thanks for your input, it did not solve my original question, but at least I know how things are.

    NSV

+ 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] I put in new formulas and it just gives me a dash
    By cal13h in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-07-2013, 08:58 PM
  2. Macro that disregards blanks when exporting a selected field
    By dylantender1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-03-2013, 10:03 PM
  3. [SOLVED] MIN MAX value separated by dash
    By sans in forum Excel General
    Replies: 4
    Last Post: 04-24-2012, 06:40 AM
  4. insert a dash
    By acp20770 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2005, 12:00 PM
  5. understanding dash dash in a excel formula
    By ldebner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-31-2005, 10:05 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