+ Reply to Thread
Results 1 to 4 of 4

Removing spaces from cells

Hybrid View

  1. #1
    Registered User
    Join Date
    04-21-2005
    Posts
    46

    Question Removing spaces from cells

    Is there a formula/function I can use to remove spaces from a cell? The only way I can think of is to create a do/loop VBA application, but it would a lot easier for my spreadsheet if I could avoid VBA. I tried using the trim function, but to no avail.

    Note that I would much prefer a formula than just doing a search/replace, as I would like to apply the formula to new spreadsheets.

    Thanks in advance.

  2. #2
    Registered User
    Join Date
    03-23-2005
    Posts
    45
    Trim should work. If you type =trim(a1), then that will remove all surrounding spaces around the data in A1.

  3. #3
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Of course, no formula can change the contents of another cell. You can, however, use a helper column to modify the contents of another cell. You can then, if desired, copy the helper cells and paste special/values over top of the original cells and delete the helper column.

    To find and remove a blank, use this formula in a helper column (B1 in this example), adjusting the cell reference as needed:

    =REPLACE(A1,FIND(" ",A1),1,"")

    "B ob" becomes "Bob"
    "Hello There" becomes "HelloThere"

    HTH

    Bruce
    Bruce
    The older I get, the better I used to be.
    USA

  4. #4
    Registered User
    Join Date
    04-21-2005
    Posts
    46
    Thanks dfeld71 - exactly what I was looking for!

+ 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