+ Reply to Thread
Results 1 to 7 of 7

Remove Blank Space at end of the txt

  1. #1
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Remove Blank Space at end of the txt

    Hi

    I need a formula to remove blank spaces at the end of the text in a cell.

    Thanks

    Regards
    Last edited by tek9step; 02-26-2010 at 05:16 AM.

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

    Re: Remove Blank Space at end of the txt

    Assuming they are genuine spaces a basic TRIM should suffice.

    If the TRIM does not work then run CODE(RIGHT(A1)) to determine trailing character and post back.

  3. #3
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Re: Remove Blank Space at end of the txt

    Morning DO

    Trim didnt work. Please find attached test file.

    regards
    Attached Files Attached Files

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

    Re: Remove Blank Space at end of the txt

    It seems the trailing char occurs only once per string so either

    a) =LEFT(A1,LEN(A1)-1)

    or

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

  5. #5
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Thumbs up Re: Remove Blank Space at end of the txt

    Thanks DO

    I understand Substitue function but could you explain Char function & CODE(RIGHT(A1)) function actually do.

    Thanks

    Regards

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

    Re: Remove Blank Space at end of the txt

    I'm guessing you know what RIGHT does, correct ?

    CODE will return the code number for a given character in relation to the character set in operation (assuming Char is valid of course).

    CHAR does the opposite of CODE - it takes the code number and reverts to Character

    Consider:

    A1: Apple!

    B1: =CODE(RIGHT(A1))

    returns 33 for me... that is the CODE # associated with ! in my character set.

    C1: =CODE(LEFT(A1))

    reutrns 65 as that i the CODE# associated with A

    conversely

    D1: =CHAR(B1)
    copied to E1

    will return ! and A respectively... ie reverts the CODE number to character.

    If you want to see the listing per your character set:

    F1: =CHAR(ROW())
    copied to F255

    (pending your version you will probably find the first 32 appear pretty much blank - they aren't they just don't display)

    NOTE: by character set we mean to differentiate between Windows & Mac.

  7. #7
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Thumbs up Re: Remove Blank Space at end of the txt

    Thanks DO it makes more sense now. Yes Right Left i understand.

    Regards

+ 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