+ Reply to Thread
Results 1 to 6 of 6

TRIM spaces in between word in one cell

  1. #1
    Registered User
    Join Date
    11-19-2007
    Posts
    85

    TRIM spaces in between word in one cell

    Hello all,

    Is it possible to trim spaces within a phrase, group of word, on the same cell?

    For example, if I have "APPLE MAKES...........PERFECT...........SENSE" in cell A1 5 spaces in between makes and perfect, and 3 spaces between perfect and sense, is it possible to trim it to only one space??

    so in essences any time we have spaces in a phrase or group of word, if it more than one, trim it to one only.


    Thanks,
    Last edited by JohnSeito; 04-28-2008 at 07:26 PM.

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Built-in: =TRIM(A1)

  3. #3
    Registered User
    Join Date
    11-19-2007
    Posts
    85
    Hi shg,

    I know that one, that one doesn't work for what I want to do. =trim(a1) only does the outside spaces, not inside of between words, this is what I want.


    =trim(a1) don't work

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    TRIM works fine, John, and reduces multiple interior spaces to one.

    You must have something other than spaces between them -- perhaps non-breaking spaces:

    =trim(substitute(A1, char(160), ""))

  5. #5
    Registered User
    Join Date
    11-19-2007
    Posts
    85
    Thanks shg, I'll see if that formula works. So how can you do both those forumla in visual basic?

    sometimes I hate to use excel formula, and then visual basic, if I use visual basic I might just use it all to finish what I want to do.

  6. #6
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Please Login or Register  to view this content.

+ 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