+ Reply to Thread
Results 1 to 7 of 7

A sorted list does not appear sorted (hidden characters). WYSIWYG.

  1. #1
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    A sorted list does not appear sorted (hidden characters). WYSIWYG.

    Sorted1.png

    The above list is sorted A - Z. It is.
    Obvious to all though, it is very much not sorted.

    Sorted2.png

    The green is the largest sorted section, and from here down, the rest of the list (not shown here) is sorted as expected.
    The orange appears to be sorted (of a sort), but why it's appearing where it is appearing.
    And the blue is even more of an oddity.

    Sorted3.png

    So I ASCII-mapped the entries - I asked the computer to show me what I did not see. And it became clear why the computer did what it did.

    I highlighted the first visible character. What's not clear is why are those preceding characters there.
    And how do I remove them.

    The idea is NOT to have to double check whether A-Z is actually sorted A-Z, but know that it sorted properly without my involvement.

    So, what do I do with this information to assure that hidden characters are stripped and WYSIWYG is in effect?

    Sheet attached.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: A sorted list does not appear sorted (hidden characters). WYSIWYG.

    I'd guess this data came from the internet. The first item has two zero-width space characters (Unicode char 8203: note the CODE function doesn't understand Unicode), and the next few out of order have one such character. You could clean the data with a bit of code like:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: A sorted list does not appear sorted (hidden characters). WYSIWYG.


    The VBA text function StrConv can convert Unicode chars to Windows …

  4. #4
    Forum Contributor
    Join Date
    09-03-2016
    Location
    Catania, Italy
    MS-Off Ver
    Excel 2019
    Posts
    164

    Re: A sorted list does not appear sorted (hidden characters). WYSIWYG.

    Hello
    The data in column A contains non-printable characters (probably they come from some site on the net).
    With the macro below I have deleted all non-printable data. Now you can order them as you please.

    Please Login or Register  to view this content.

    Hello,
    Mario


    PS - I apologize for not reading the previous posts while I was writing.
    Last edited by Marius44; 03-16-2022 at 02:06 PM. Reason: apologize

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Try this …


    Edit :

    I moved to StrConv 'cause post #2 does not work as expected on my side.
    But after some memories came back so here the Range.Replace is the easy way to go but with an empty string rather than vbNullString :

    PHP Code: 
    Sub Demo1()
        
    With [A3].CurrentRegion
            
    .Replace ChrW(8203), ""2
            
    .Sort .Cells(1), 1Header:=2
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 03-16-2022 at 10:49 PM.

  6. #6
    Forum Contributor
    Join Date
    04-03-2009
    Location
    Anchorage, Alaska, USA
    MS-Off Ver
    Office 365
    Posts
    113

    Re: A sorted list does not appear sorted (hidden characters). WYSIWYG.

    So you're all saying you cant trust everything on the internet. Who knew!

    Good call on that. Yes, the source is from the net. Office Ally > Resource Center > Payer List > Professional & Institutional list, to be exact.

    Taking care of hidden characters like this reminds me that no one appreciates macros except those that make macros, cause when they work it's in the blink of an eye.

    Thank you. I'll check this in a moment and repost. Working on another project atm.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: A sorted list does not appear sorted (hidden characters). WYSIWYG.


    I changed my mind, see post #5 …

+ 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] Extract a non-sorted list with blank cells into a sorted list
    By RJK in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2015, 12:41 AM
  2. Replies: 2
    Last Post: 03-07-2015, 08:17 PM
  3. Replies: 1
    Last Post: 03-06-2015, 09:54 PM
  4. Replies: 0
    Last Post: 03-06-2015, 03:07 PM
  5. Replies: 0
    Last Post: 03-06-2015, 12:43 PM
  6. sorted list
    By jc67 in forum Excel General
    Replies: 1
    Last Post: 11-22-2011, 03:36 AM
  7. last row in sorted list
    By TxRaistlin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2005, 07:06 PM

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