+ Reply to Thread
Results 1 to 3 of 3

Removing blank spaces from the beginning of cells

  1. #1
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Removing blank spaces from the beginning of cells

    I'm compiling several old worksheets into a single database for a research study. The worksheets contain patient data. Some of the worksheets have the patient's last name, first name, and middle initial entered all in one cell like this: Smith,John R. Compounding the problem is the fact that sometimes the name is entered with a space between the comma and the first name, sometimes not.

    I have formulas to break the name out into three separate columns "lName, "fName", "midInit". However, if the name in the original cell has a space between the coma and the first name, then the “fname” column will contain a blank space in front of the name. This is problem because patients names can appear in the database more than once. Some patients are in the database several times.


    If patient “John R. Smith”, for example, is entered in the database as”

    “Smith” “John” “R “

    and also as

    “Smith” “<space>John” “R”


    then the database won’t recognize them as the same name when I search for John Smith’s data. Right?

    If so, then I need a way to eliminate the empty spaces in front of the first names. Like I said, some have empty spaces and some don’t. I could do this by hand, but there are over 1000 entries in these worksheets.
    Last edited by Research RN; 06-17-2009 at 11:38 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Removing blank spaces from the beginning of cells

    trim(a1) will do it
    or an array entered vlookup will do them in situ
    {=VLOOKUP(D1,TRIM($A$1:$B$2),2,FALSE)}
    Last edited by martindwilson; 06-16-2009 at 04:23 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    11-07-2008
    Location
    St. Louis, Missouri, USA
    MS-Off Ver
    2003
    Posts
    50

    Re: Removing blank spaces from the beginning of cells

    Quote Originally Posted by martindwilson View Post
    trim(a1) will do it
    or an array entered vlookup will do them in situ
    {=VLOOKUP(D1,TRIM($A$1:$B$2),2,FALSE)}
    Works like a charm!

    Thanks, Martin

+ 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