+ Reply to Thread
Results 1 to 5 of 5

Find the last space

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Find the last space

    I am guessing this is an easy question, but I can't figure out how to do it. I need to strip out a number at the end of a string in my spreadsheet. The exact format of the string will vary (length, position of spaces, number of spaces, etc.) but the number is always at the end, and always follows the last space. Is there a way to find it and copy (or move) it to the next cell?

    Thanks!
    "Laugh? I thought I'd die!"

    Jimbo?

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Find the last space

    =left(trim(a2),len(trim(a2))-1)
    =right(trim(a2),1)
    the first will give the stripped version of a2
    the second will give the last character of a2
    the trim() is to make sure there is a readable character

  3. #3
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Re: Find the last space

    RCM,

    That doesn't seem to do what I need. here is a sample file. hopefully that will make things clearer.
    Attached Files Attached Files

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

    Re: Find the last space

    b4 =SUBSTITUTE(A4&"^",C4&"^","")
    c4=TRIM(RIGHT(SUBSTITUTE(A4," ",REPT(" ",20)),4))
    "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

  5. #5
    Forum Contributor
    Join Date
    11-30-2012
    Location
    Seattle, WA
    MS-Off Ver
    Office 2007
    Posts
    212

    Re: Find the last space

    These work great!! thanks for your help!!

+ 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. [SOLVED] Need to find number before space
    By Reykjavik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-25-2014, 01:25 PM
  2. Find 1st character after a space
    By milo1984 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-07-2013, 09:07 AM
  3. Find last space in a cell
    By Basz in forum Excel General
    Replies: 4
    Last Post: 01-31-2011, 09:24 AM
  4. How to make .Find to find string with space char?
    By selimhanov in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2009, 05:23 AM
  5. Find last space from the right of text
    By Michael in forum Excel General
    Replies: 7
    Last Post: 03-28-2005, 08:06 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