+ Reply to Thread
Results 1 to 13 of 13

How to remove a space in the front

  1. #1
    Registered User
    Join Date
    04-12-2010
    Location
    Surrey
    MS-Off Ver
    Excel 2007
    Posts
    26

    How to remove a space in the front

    Hello,

    I copied over 1000 rows into a spreadsheet but when I paste them, there is a extra space (space bar) before the filename in the cell. It is like this for all rows

    How do I remove that extra space in front of the filename?

    thanks

    see attached
    Attached Files Attached Files

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

    Re: How to remove a space in the front

    Hi gurp99,
    Your data has that darn char(160) in front and in the rear of each string. It looks like a space but isn't
    In B1 and copy down this formula to remove all of them.
    Please Login or Register  to view this content.
    Copy and then Paste (Values Only) over the old text to have clean data.

    hope that helps.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    04-12-2010
    Location
    Surrey
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: How to remove a space in the front

    Quote Originally Posted by MarvinP View Post
    Hi gurp99,
    Your data has that darn char(160) in front and in the rear of each string. It looks like a space but isn't
    In B1 and copy down this formula to remove all of them.
    Please Login or Register  to view this content.
    Copy and then Paste (Values Only) over the old text to have clean data.

    hope that helps.
    works like a charm, thank you

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: How to remove a space in the front

    gurp99,

    They are ASCII 160 characters (not space characters).

    To remove them:

    Click on the first cell in column A.
    Then press the F2 key
    Copy the leading character

    Then click on the column containing the data that contains the ASCII 160 characters.

    Then click and hold down the ALT key and press the E key

    Then presss the F key

    On the Find tab, In the Find what: box paste in the ASCII 160 character that you copied.

    Click on the Replace tab

    And then click on the Replace All button, the click on the Close button
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to remove a space in the front

    or just in find
    hold down alt key type 0160 on the numeric keypad
    replace all
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: How to remove a space in the front

    Hi guys, how does one recognise that the space is char 160 and not an ordinary space? what distinguishing features does it have? thanks alot.
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to remove a space in the front

    just use =CODE(A1) that will give you the character code of the first char or code(right(a1)) for last or use mid or delete some and leave it on its own,

  8. #8
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: How to remove a space in the front

    Thanks martin

  9. #9
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: How to remove a space in the front

    Hi Darren
    although your question is relevant to this thread, next time better start a new one,as it is a different subject and the information contained might not be found by others interested when embedded in a thread.

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

    Re: How to remove a space in the front

    @Blake,

    To solve this problem here is how it went. I think this will appease arthurbr.

    Next to A1 in B1 I used the formula =Trim(A1)
    Then in C1 I used the formula =Len(A1)
    and in D1 I used the formula =Len(B1)
    The Lenght of both strings were the same after the Trim function.
    This meant the spaces in front weren't spaces as Trim would have removed them.

    To determine what the first character was I used this formula: =CODE(LEFT(A1,1))
    which returned the number of 160. This then lead to the above answer(s).

    I hope this fully explains this problem and how it lead to the answer.

  11. #11
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: How to remove a space in the front

    Thanks alot Marv for your comprehensive response and for taking the time to do so.

    Hi Art - thanks for the heads up.

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to remove a space in the front

    while were at it!
    left(a1)=left(a1,1) and code(a1)=code(left(a1)) both
    code and left on their own look to the left most character without any further arguments

  13. #13
    Registered User
    Join Date
    01-06-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: How to remove a space in the front

    Not sure if this is relevant, but "ASAP utilities" can remove excessive spaces [even this char(160)].

    You might find it to be worthwhile to check out:

    http://www.asap-utilities.com/

    Cheers.

+ 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