+ Reply to Thread
Results 1 to 11 of 11

Removing Front Space

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Removing Front Space

    I deal a lot with copy and paste data. Sometimes there is a front space which messes up the sorting function.

    Is there a way to remove front space from multiple cells at one time? Or is the answer going one by one and removing the spaces individually?


    Thanks in advance

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Removing Front Space

    Are you sure it is a "normal" space (with a code of 32), or could it be a non-breaking space (code = 160) ?

    You could try the TRIM function in a separate column, which will remove leading and trailing spaces, as well as multiple spaces, but it does only act on normal spaces.

    If you are certain it is only a single "space", then you could use the RIGHT function in conjunction with LEN.

    You could also use the SUBSTITUTE function to change CHAR(160) characters to nothing.

    But, it would help to see what your data looks like, so could you attach a sample workbook?

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post. Don't try to use the Paperclip icon, as it doesn't work on this forum.

    Hope this helps.

    Pete

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Removing Front Space

    it depends, if it is a leading space and there are no other spaces then find and replace all should work.
    a different option is to use trim which will remove leading and trailing spaces.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Re: Removing Front Space

    The current selection I am dealing with I had to use Find & Select > Go To Special > Objects and deleted images which left a space that Trim does not seem to affect

  5. #5
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Re: Removing Front Space

    Workbook added.

    As you can see there is a front space starting with Amanda Palmer through Zolar X then it goes back to my normal list alphabetized correctly
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Re: Removing Front Space

    Unless i am using Trim incorrectly, which I probably am.

  7. #7
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Re: Removing Front Space

    The current selection I am dealing with I had to use Find & Select > Go To Special > Objects and deleted images which left a space that Trim does not seem to affect

    Workbook added.

    As you can see there is a front space starting with Amanda Palmer through Zolar X then it goes back to my normal list alphabetized correctly

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Removing Front Space

    If you put this formula in C6:

    =CODE(A6)

    it returns 160. You can get rid of all those non-breaking spaces (TRIM does not work on them) in one operation by highlighting column A and using Find & Replace (CTRL-H), with:

    Find What: Alt-0160

    Replace with: (leave blank)

    Click Replace All, where Alt-0160 means to hold down the Alt key and type 0160 on the numeric keypad (or you could just copy that character from one of the offending cells).

    When I did it on your file, there were 6436 replacements.

    Hope this helps.

    Pete

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Removing Front Space

    Ok, what I did was go to the first cell with the space (it may not be a typical space) and highlighted the space preceding Amanda's name and copied it, then pasted it into find and replace, left replace blank and hit replace all and they are all gone BUT not the ones between first and last names. try that, you can always hit undo if you don't like the results.

  10. #10
    Registered User
    Join Date
    12-23-2015
    Location
    San Antonio
    MS-Off Ver
    2013
    Posts
    18

    Re: Removing Front Space

    Thank you all so much, both suggestions worked amazingly.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Removing Front Space

    Glad to help, and thanks for the rep.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark this thread as SOLVED.

    Pete

+ 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. Formatting date with space at the front
    By earabit in forum Excel General
    Replies: 6
    Last Post: 10-03-2018, 03:25 AM
  2. [SOLVED] insert space in front of any question, if a space is not present
    By OhioRuss in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2018, 06:45 PM
  3. [SOLVED] Removing a space that is in front of my date
    By RJL3313 in forum Excel General
    Replies: 2
    Last Post: 06-17-2015, 11:35 AM
  4. [SOLVED] Help Please! Cant understand what is this space in front of values
    By dimitrov_dimityr in forum Excel General
    Replies: 4
    Last Post: 10-21-2013, 06:55 AM
  5. How to remove a space in the front
    By gurp99 in forum Excel General
    Replies: 12
    Last Post: 01-30-2011, 05:21 PM
  6. How to remove space and symbols in front of words
    By Jeff M in forum Excel General
    Replies: 2
    Last Post: 03-26-2009, 12:56 PM
  7. get rid of space in front of a word
    By CENorth7272 in forum Excel General
    Replies: 2
    Last Post: 02-01-2005, 10:19 AM

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