+ Reply to Thread
Results 1 to 5 of 5

Removing spaces from text

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2008
    Posts
    76

    Removing spaces from text

    All,

    I am having big problems removing spaces.

    I have copied a HTML table into excel. a typical cell might contain a number and spaces infront and behind it.

    E.G Cell A1 contains " 10000 ", 8 characters (2 spaces)

    I used the TRIM command and it does not work as the cell A1 still contains 8 characters instead of 5.

    Note the numbers are stored in General format.

    Any ideas?

    David32

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try the CLEAN() Function also
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    One common problem copying from html to Excel is the prevalence of non-breaking spaces in html. These are ascii character 160 and they are, unfortunately, not removed by the CLEAN function. Try a Find/Replace on your worksheet (select A1 then hit Ctrl+H) and in the Find What box hold down your Alt key and from the numeric keypad type 0160. This should insert the character 160. Leave the Replace With box empty and hit Replace All to remove all of these characters from your sheet.

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    Some of us create a tiny macro:

    Sub Clear_Spaces()
    Selection.Replace " ", ""
    End Sub
    and pin it to Ctrl+Shift+H (i.e. "looks like" Ctrl+H)

    For just such irritations...

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    Hampshire
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Removing spaces from text

    found answer elsewhere, sorry for post
    Last edited by wombleuk; 03-17-2014 at 10:29 AM.

+ 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