+ Reply to Thread
Results 1 to 8 of 8

Formula for removing space or unknown character. (Trim is not working)

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    India
    MS-Off Ver
    Excel 2019
    Posts
    61

    Formula for removing space or unknown character. (Trim is not working)

    Hi There,

    I am trying to use the formula “=Trim()” to remove space or unknown character, but this formula is not working. Some body can share the formula to fix this.

    Example Sheet Attached. (Name Michale*Arun Kumar, there is unknown space or character between Micale (Space) Arun.

    Senthil

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula for removing space or unknown character. (Trim is not working)

    You're right, it's not a standard space, it's a 'non breaking' space, char(160)
    But even if it was a space, Trim wouldn't remove it anyway.
    Because trim doesn't simply remove spaces....It removes 'extra' spaces.
    So a single space between 2 characters is not considered 'extra'
    Trim is generally meant for removing leading and trailing spaces.


    Anyway, try
    =SUBSTITUTE(A1,CHAR(160),"")
    Last edited by Jonmo1; 02-06-2014 at 03:57 PM.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula for removing space or unknown character. (Trim is not working)

    That's the 8th character in cell A1 - you can find out what character that is with this formula

    =CODE(MID(A1,8,1))

    that gives me 160 so remove all those characters from A1 with this formula

    =SUBSTITUTE(A1,CHAR(160),"")
    Audere est facere

  4. #4
    Registered User
    Join Date
    09-19-2013
    Location
    India
    MS-Off Ver
    Excel 2019
    Posts
    61

    Re: Formula for removing space or unknown character. (Trim is not working)

    Quote Originally Posted by Jonmo1 View Post
    You're right, it's not a space, it's a hard return, char(160)
    But even if it was a space, Trim wouldn't remove it anyway.
    Because trim doesn't simply remove spaces....It removes 'extra' spaces.
    So a single space between 2 characters is not considered 'extra'
    Trim is generally meant for removing leading and trailing spaces.


    Anyway, try
    =SUBSTITUTE(A1,CHAR(160),"")
    Hi Jonmo,

    Thanks.. cocenrn given below, please fix this

    if i use the said formula i am getting result as "MichaleArun Kumar". The name should reflect as "Micale Arun Kumar" There should be space between Michale and Arun. (Only unknow character should remove and space has to come)

    Senthil

  5. #5
    Registered User
    Join Date
    09-19-2013
    Location
    India
    MS-Off Ver
    Excel 2019
    Posts
    61

    Re: Formula for removing space or unknown character. (Trim is not working)

    Hi Daddylonglegs,

    Thanks..

    if i use the said formula i am getting result as "MichaleArun Kumar". The name should reflect as "Micale Arun Kumar". space should be there between Michale and Arun. (Only unknow character should remove). Please help me fix this.

    Senthil

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula for removing space or unknown character. (Trim is not working)

    Well, your post inidicated that you were trying to 'remove' the space or unknown character between Michale and Arun
    It didn't say anything about 'replacing' it with a different character.

    You can just change
    =SUBSTITUTE(A1,CHAR(160),"")
    to
    =SUBSTITUTE(A1,CHAR(160)," ")

  7. #7
    Registered User
    Join Date
    09-19-2013
    Location
    India
    MS-Off Ver
    Excel 2019
    Posts
    61

    Re: Formula for removing space or unknown character. (Trim is not working)

    Hi Jonmo,

    Thanks it is working fine.

    Senthil

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula for removing space or unknown character. (Trim is not working)

    You're 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. Removing character using Trim..
    By Jocote46 in forum Excel General
    Replies: 5
    Last Post: 05-13-2009, 01:57 PM
  2. 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
  3. Removing unwanted, unknown character?
    By bthieson in forum Excel General
    Replies: 2
    Last Post: 10-06-2006, 06:35 PM
  4. Replies: 7
    Last Post: 04-12-2006, 11:00 PM
  5. removing "space" character
    By crapit in forum Excel General
    Replies: 3
    Last Post: 11-08-2005, 10:10 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