+ Reply to Thread
Results 1 to 6 of 6

read characters starting from the right until a space is reached

  1. #1
    Registered User
    Join Date
    08-22-2003
    Posts
    11

    read characters starting from the right until a space is reached

    Is there a function to read values starting from the right of a cell and pulling characters until I reach a space?

    Two examples:
    SGA3220R_IAOAKTREE (BTL-3) 1177 64089 - would return "64089"
    SGA3321R_IAREDROAD (BTL-3) 1177 975 - would return "975"

    I know I could do a Text to Columns with a space delimiter but was hoping to find something easier. Thanks in advance for any help.

  2. #2
    pinmaster
    Guest
    Try:
    =LEFT(A1,FIND(" ",A1)-1)

    or
    in case there are no spaces in A1
    =IF(ISERROR(LEFT(A1,FIND(" ",A1)-1)),A1,LEFT(A1,FIND(" ",A1)-1))


    HTH
    JG

    oops...guess I wasn't paying attention
    Last edited by pinmaster; 01-04-2006 at 01:43 PM.

  3. #3
    PCLIVE
    Guest

    Re: read characters starting from the right until a space is reached

    With your data in A1, this formula will work given that "(BTL-3) 1177 " will
    always precede the number that you want to return.

    =RIGHT(A1,(LEN(A1)-FIND("(BTL-3) ",A1)-12))

    Hope this helps,
    Paul

    "wolfpack95" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Is there a function to read values starting from the right of a cell and
    > pulling characters until I reach a space?
    >
    > Two examples:
    > SGA3220R_IAOAKTREE (BTL-3) 1177 64089 - would return "64089"
    > SGA3321R_IAREDROAD (BTL-3) 1177 975 - would return "975"
    >
    > I know I could do a Text to Columns with a space delimiter but was
    > hoping to find something easier. Thanks in advance for any help.
    >
    >
    > --
    > wolfpack95
    > ------------------------------------------------------------------------
    > wolfpack95's Profile:
    > http://www.excelforum.com/member.php...info&userid=93
    > View this thread: http://www.excelforum.com/showthread...hreadid=497953
    >




  4. #4
    Forum Contributor
    Join Date
    12-02-2004
    Location
    London
    Posts
    255
    Assuming that the text will never use the character "^", then use the following formula:-

    =RIGHT(A1,LEN(A1)-FIND("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),1))

    If "^" is used replace it with a character that will never appear e.g. ¬ or ¦

  5. #5
    Ron Coderre
    Guest

    RE: read characters starting from the right until a space is reached

    And....another way for when there may be more than 1 space:

    A1: (some text)
    B1: =RIGHT(A1,MATCH("
    ",MID(A1,LEN(A1)+1-ROW(INDIRECT("1:"&(LEN(A1)))),1),0)-1)

    Note: Commit that array formula by holding down [Ctrl]+[Shift] when you
    press [enter]


    Does that help?

    ***********
    Regards,
    Ron

    XL2002, WinXP-Pro


    "wolfpack95" wrote:

    >
    > Is there a function to read values starting from the right of a cell and
    > pulling characters until I reach a space?
    >
    > Two examples:
    > SGA3220R_IAOAKTREE (BTL-3) 1177 64089 - would return "64089"
    > SGA3321R_IAREDROAD (BTL-3) 1177 975 - would return "975"
    >
    > I know I could do a Text to Columns with a space delimiter but was
    > hoping to find something easier. Thanks in advance for any help.
    >
    >
    > --
    > wolfpack95
    > ------------------------------------------------------------------------
    > wolfpack95's Profile: http://www.excelforum.com/member.php...info&userid=93
    > View this thread: http://www.excelforum.com/showthread...hreadid=497953
    >
    >


  6. #6
    Registered User
    Join Date
    08-22-2003
    Posts
    11
    Thanks for all the replies. Ron Coderre's formula does what I need.

+ 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