+ Reply to Thread
Results 1 to 6 of 6

Two questions

  1. #1
    Registered User
    Join Date
    05-10-2005
    Posts
    4

    Two questions

    Is it possible to do the following two things?

    1) Count the number of characters (including spaces) in a cell?

    2) Find and replace the initial space in cells? I have a document that has over two thousand alpha strings. Many of them have an initial space which I need to remove. Manually, this is a pain.

  2. #2
    Forum Contributor
    Join Date
    06-21-2004
    Posts
    106
    going to answer both questions in one:

    =RIGHT(<a1>,LENB(a1)-1)

    copy down

    hope this helps(but you probably want to make sure that NONE of your text has a space at the end too).

  3. #3
    Forum Contributor
    Join Date
    06-21-2004
    Posts
    106
    forgot another caution: make sure that the initial space is actually just 1 space.

    I hope someone else has a QA safer way.

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Quote Originally Posted by Intelligence3
    1) Count the number of characters (including spaces) in a cell?
    Use the LEN function...

    =LEN(A1)

    2) Find and replace the initial space in cells? I have a document that has over two thousand alpha strings. Many of them have an initial space which I need to remove. Manually, this is a pain.
    If by 'initial space' you mean the first character in each cell, try...

    =RIGHT(A1,LEN(A1)-1)

    If by 'initial space' you mean the first instance in each cell, try...

    =SUBSTITUTE(A1," ","",1)

    Then, select your cell or range of cells and > Edit > Copy > Edit > Paste Special > Values > Ok.

    Hope this helps!

  5. #5
    Registered User
    Join Date
    05-10-2005
    Posts
    4
    Thanks for the replies!

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,843
    There's also the TRIM worksheet function that removes all "excess" spaces in a text string. If I put " hello everyone " in a cell, then apply the TRIM function, I get "hello everyone" back without the leading or trailing spaces, or the extra spaces between words.

+ 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