+ Reply to Thread
Results 1 to 13 of 13

Trim Formula not working

  1. #1
    Forum Contributor
    Join Date
    02-26-2010
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    164

    Trim Formula not working

    For some reason the trim formula is not working. There is a space after every word in this document. I'm trying to remove that space. I did the trim formula then copied down. Then I copied paste special to a new column & the space is still showing up.

    Thanks
    Attached Files Attached Files
    Last edited by Statz; 06-17-2016 at 11:13 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,266

    Re: Trim Formula not working

    Hey Statz,

    I'd bet those things that look like spaces are really character 160. Do a replace all of them with spaces and try again.

    Just looked at your workbook.. Perhaps you need to turn on your calculation mode to automatic? On the Formulas Tab look at Calculations Options.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,889

    Re: Trim Formula not working

    If you are removing spaces between words also try this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let me know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    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
    48,182

    Re: Trim Formula not working

    It's a non-breaking space, not a space. Use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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


  5. #5
    Forum Contributor
    Join Date
    02-26-2010
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    164

    Re: Trim Formula not working

    Quote Originally Posted by MarvinP View Post
    Hey Statz,

    I'd bet those things that look like spaces are really character 160. Do a replace all of them with spaces and try again.

    Just looked at your workbook.. Perhaps you need to turn on your calculation mode to automatic? On the Formulas Tab look at Calculations Options.
    I think you're right about them not being spaces. I went ahead and deleted the "space" then did a few more spaces and the trim formula works.

    But what is character 160? Not sure what you're referring to there.

    Thanks!!

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,266

    Re: Trim Formula not working

    Hey Statz,

    I find those character 160 in a lot of the old mainframe generated text docs. Some old software just threw out a 160 instead of spaces. I'm clueless on why...
    Read:
    http://www.adamkoch.com/2009/07/25/w...character-160/ or
    http://www.utexas.edu/learn/html/spchar.html
    Last edited by MarvinP; 06-16-2016 at 04:23 PM.

  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
    48,182

    Re: Trim Formula not working

    See post #4. I see this a lot in data that has been downloaded from web sites.

  8. #8
    Forum Contributor
    Join Date
    02-26-2010
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    164

    Re: Trim Formula not working

    Hey.TMS.

    I tried your formula and it looks like it worked for almost all but not some. I attached a file and highlighted the issues in red.

    Thanks

    EDIT:I did copy this from a web page btw. Might be why there is an issue.

  9. #9
    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
    48,182

    Re: Trim Formula not working



    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down

  10. #10
    Forum Contributor
    Join Date
    02-26-2010
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    164

    Re: Trim Formula not working

    Quote Originally Posted by TMS View Post


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy down
    Thank you for doing this. Did you just have to use trim instead of the 1st formula? just kinda curious why.

    Also, in my file I attached in post 8. I was going to apply filters at the top so I can sort in descending/ascending order to see the "0". But because of the count if formula I have it never works correctly. Any idea why this happens?

    Thank you!

  11. #11
    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
    48,182

    Re: Trim Formula not working

    Well, I guess some values end in a normal space, which is fixed with TRIM. Others end in a non-breaking space (character code 160) which isn't. Others probably have neither. So, we use SUBSTITUTE to sort out the CHAR(160) and TRIM to remove the real trailing space(s). As shown, you can just combine the functions.

    As for the COUNTIF, no idea.

  12. #12
    Forum Contributor
    Join Date
    02-26-2010
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    164

    Re: Trim Formula not working

    Thanks again! And everybody who chimed in.

  13. #13
    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
    48,182

    Re: Trim Formula not working

    You're welcome. Thanks for the rep.

+ 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] Formula for removing space or unknown character. (Trim is not working)
    By senthile in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-06-2014, 04:08 PM
  2. [SOLVED] TRIM formula not working from 2 3 2 to 232
    By nur2544 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-07-2013, 08:07 AM
  3. [SOLVED] Clean and Trim Not Working
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-05-2013, 07:14 PM
  4. Trim Function not working...help!
    By Taycore in forum Excel General
    Replies: 1
    Last Post: 05-13-2012, 02:22 AM
  5. Excel 2007 : trim formula not working
    By jfs in forum Excel General
    Replies: 9
    Last Post: 05-10-2011, 11:46 AM
  6. Trying to trim a trailing space char and the Trim function isn't working
    By Psychochook in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2007, 11:28 PM
  7. Trim not working....
    By FlatEric in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2006, 09:30 AM
  8. Trim not working
    By Stuart in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2005, 03:06 PM

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