+ Reply to Thread
Results 1 to 14 of 14

Find Hidden Characters

  1. #1
    Forum Contributor
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    109

    Find Hidden Characters

    I am creating a unique list from 2 different data sources. I am not able to figure out why some cells looks exactly the same but are different values. I am assuming there are hidden characters in cells.

    1. Can anyone look at attached and ID the hidden characters?
    2. How do I remove all hidden characters using power query?

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,697

    Re: Find Hidden Characters

    I'm not up on power query but just to ask, why do you think there are hidden figures in cells A2 through A5 or is there a different area you are looking at?
    for example, =LEN(A2) (same for A3) returns 31 which is the count of the letters and spaces within the text Ally/Supporter of Self-Advocate.
    =LEN(A4) and A5 both return 30 also the count of letters and spaces within the text Family Member of Self-Advocate.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,457

    Re: Find Hidden Characters

    Here's how I would do this:

    1) In C2, enter =LEN(A2) just to know how long each text string is.
    2) In D1:AZ1 (or however far to the right I need for the longest text string I will ever need), enter the numbers 1 to 49.
    3) In D2, enter =CODE(MID($A2,D$1,1)). Note the mix of relative and absolute references, then copy/paste/fill into D2:AZ5.

    Now I have rows that show the ASCII code number for each character in each string, and I can compare these numbers.

    The thing I notice is that rows 2 and 4 are using code 32 space characters for the spaces in the text string. Rows 3 and 5, on the other hand, are using code 160 space characters. I haven't looked at each string thoroughly, but that appears to be one common difference between what otherwise should be equivalent text strings.

    What to do next depends on exactly how you want to approach the discrepancy, but I would expect some kind of Find/Replace task or REPLACE() or SUBSTITUTE() functions or equivalent that would "clean up" these kind of "same but different" characters.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,995

    Re: Find Hidden Characters

    The characters that look like spaces in the second version of the strings are actually non-breaking spaces. A regular space is code 32 and your spaces are code 160.

    You can fix this by a single Find & Replace All. In the Find box hold the ALT key and type 0160 on the numeric keypad. In the Replace box just type a space.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Find Hidden Characters

    Yes...

    =TRANSPOSE(CODE(MID(Table1[@[What is your role?]],SEQUENCE(LEN(Table1[@[What is your role?]])),1)))

    tells you what characters are in each string. You can see (yellow) where Char 160 replaces space (Char 32).

    You can use this instead of countif:

    =SUMPRODUCT(--(SUBSTITUTE([What is your role?],CHAR(160)," ")=SUBSTITUTE([@[What is your role?]],CHAR(160)," ")))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Contributor
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    109

    Re: Find Hidden Characters

    Glenn - any idea how to do this in PQ?

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Find Hidden Characters

    LoL... No idea at all. I never even attempted to learn PQ.

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,457

    Re: Find Hidden Characters

    A quick internet search found this help page: https://learn.microsoft.com/en-us/po...m/text-replace

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Find Hidden Characters

    MrS... not for me, I'm wayyy to long in the tooth for learning something entirely new.

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,697

    Re: Find Hidden Characters

    wow, looking in on this again this isn't a direction I thought this was going... interesting (I know, at least one of you is probably saying to yourself, yeah we know).

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Find Hidden Characters

    maybe

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    CHAR(160) <=> #(00A0) (non-breaking space)
    Last edited by sandy666; 03-28-2023 at 05:18 PM.

  12. #12
    Forum Contributor
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    109

    Re: Find Hidden Characters

    I refused to listen when they said "you can't teach an old dog new tricks" . Thanks for the formula suggestions Glenn

  13. #13
    Forum Contributor
    Join Date
    03-12-2022
    Location
    Atlanta, Georgia
    MS-Off Ver
    365
    Posts
    109

    Re: Find Hidden Characters

    That worked....thanks Sandy

  14. #14
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Find Hidden Characters

    You are welcome

+ 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] Cell has hidden characters and i think they are quotes but not sure
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-16-2015, 10:19 AM
  2. Hidden characters in Excel
    By ThomasLard in forum Excel General
    Replies: 10
    Last Post: 07-10-2014, 10:31 AM
  3. Replies: 2
    Last Post: 03-21-2014, 11:32 AM
  4. Excel 2007 : CSV Issue - Hidden Characters? - Please Help
    By mexicanadian in forum Excel General
    Replies: 0
    Last Post: 06-19-2011, 07:53 PM
  5. Trouble removing hidden characters
    By Onestopfanshop in forum Excel General
    Replies: 3
    Last Post: 06-23-2009, 04:43 AM
  6. [SOLVED] Hidden characters
    By Rookie 1st class in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2005, 06:30 PM
  7. Help! Can't get rid of hidden characters
    By tragopanic in forum Excel General
    Replies: 1
    Last Post: 07-13-2005, 06:05 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