+ Reply to Thread
Results 1 to 5 of 5

Why does the trim() function not working? This is so bizarre!

  1. #1
    Registered User
    Join Date
    08-10-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Why does the trim() function not working? This is so bizarre!

    This is so bizarre! Please download the attachment and check it out. I am trying to get Excel to remove spaces at the end of a whole bunch of texts, but the trim() function is just not removing those spaces!

    Download the attachment and look. I'm trying use the trim() function to remove the space at the end of the word Astros in cell A1. But after trimming it, the space is still there!

    On cell A2 I personally typed out the word Houston Astros and then put a space at the end, and, and then did the same trim function and it works properly.

    This leads me to believe that the space at the end of cell A1 is not really space after all. It has to be something else and not a space, that's why the trim function is not removing it. But if it is not a space, then what exactly is it??

    How do I remove the space at the end of the word Astros in cell A1 using an Excel function?

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Why does the trim() function not working? This is so bizarre!

    Your spaces are in fact non-breaking line feeds - you can verify this using:

    =CODE(RIGHT(A1))

    which will return 160 rather than 32 (space)

    To account for this:

    =SUBSTITUTE(A1,CHAR(160),"")

  3. #3
    Valued Forum Contributor
    Join Date
    05-23-2011
    Location
    Lahore PK
    MS-Off Ver
    Excel 2007, 2013
    Posts
    627

    Re: Why does the trim() function not working? This is so bizarre!

    Hi tjj
    try the follwoing

    copy the last space in cell A1
    press Ctrl+H
    paste the space in Find what and press replace all
    Azam
    If you want to say Thank you to a member, click the reputation icon (Star) in the left bottom of the post.
    For prompt answer, be descriptive, concise, short, direct, and to-the-point.

  4. #4
    Registered User
    Join Date
    08-10-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Why does the trim() function not working? This is so bizarre!

    Perfect solution DonkeyOte!

  5. #5
    Registered User
    Join Date
    10-05-2016
    Location
    Manila, Philippines
    MS-Off Ver
    2010
    Posts
    1

    Re: Why does the trim() function not working? This is so bizarre!

    Quote Originally Posted by Azam Ali View Post
    Hi tjj
    try the follwoing

    copy the last space in cell A1
    press Ctrl+H
    paste the space in Find what and press replace all
    this worked for me
    thanks much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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