+ Reply to Thread
Results 1 to 8 of 8

Remove everything right once a space is countered (variable length text to left needed)

  1. #1
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Boston
    MS-Off Ver
    MS 365
    Posts
    225

    Remove everything right once a space is countered (variable length text to left needed)

    Remove everything right once a space is countered (variable length text to left needed)

    Example; Column A includes serial numbers of variable length typically 4 - 14 in length followed by a space or two then comments. None of the serial numbers have imbedded spaces. I only need the serial number and want to trim all to the right INCLUDING the space.

    Column A Data example:
    truck-101 Nice color, low miles
    bike-12345687 slight wear but solid

    Desired Result
    truck-101
    bike-12345687

    Thanks for any direction, hopefully non programming solution may be found.

    Best jj

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Remove everything right once a space is countered (variable length text to left needed

    This should work:
    =LEFT(A2,FIND(" ",A2)-1)

  3. #3
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Boston
    MS-Off Ver
    MS 365
    Posts
    225

    Re: Remove everything right once a space is countered (variable length text to left needed

    This site is great, thanks PaulM.

    This does exactly what I want but I don't know how to get the resulting data posted to another column as values only (not tied to the formula.)

    When I copy and paste as values only into another column it picks up spaces to the right. How do I get around that, however this is workable.

    Regards,

    jj

  4. #4
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Remove everything right once a space is countered (variable length text to left needed

    Change it to:

    =TRIM(LEFT(A2,FIND(" ",A2)-1))

  5. #5
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Boston
    MS-Off Ver
    MS 365
    Posts
    225

    Re: Remove everything right once a space is countered (variable length text to left needed

    The original formula was equally effective as this one, thank you Paul, my issue is getting the resulting data without trailing spaces into another column that is not
    formula dependent.

    Regards,

    jj

  6. #6
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Remove everything right once a space is countered (variable length text to left needed

    I am a bit unclear. The TRIM function does that. Maybe you have non breaking spaces. Try this:

    =substitute(TRIM(LEFT(A2,FIND(" ",A2)-1)),char(160),"")

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Remove everything right once a space is countered (variable length text to left needed

    In case you do have a non-braking character (char 160) use this

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  8. #8
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Boston
    MS-Off Ver
    MS 365
    Posts
    225

    Re: Remove everything right once a space is countered (variable length text to left needed

    That's perfect!! Would not have figured that our ever. It was key to get the spaces out as the resulting data is later compared to other data that does not have spaces so the matches would be missed.
    Thanks Paul and AlKey

    -jj

+ 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. How to remove space on left of text?I can’t backspace it.
    By Excelforum*ser_mH7 in forum Excel General
    Replies: 11
    Last Post: 05-30-2018, 12:34 PM
  2. Replies: 3
    Last Post: 10-31-2012, 11:20 PM
  3. Remove text between quotes, variable length and number of quotes
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-14-2011, 10:40 AM
  4. remove space in empty variable when using printToFile
    By cjg123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2011, 11:45 AM
  5. VBA variable length array help needed
    By Trinidad3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2010, 06:19 PM
  6. Remove text of variable length from cell
    By dziw in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-27-2007, 01:06 PM
  7. Passing Variable length Space Characters to Variables
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2006, 07:40 PM

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