+ Reply to Thread
Results 1 to 4 of 4

pulling text from the middle of a string

  1. #1
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    pulling text from the middle of a string

    simple question for you here. I have three examples of text that will be in the cells.

    Lloyd 8REC-60YDS 11PTS
    Olsen 1REC-13YDS 1PT
    Bironas 23YD FG 1XP 4PTS

    I need to pull out just the number of points that each player scored. I currently have it set up with 2 helper cells the first cell pulls out the 5 characters from the right. leaving

    11PTS
    (space)(space)1PT
    (space)4PTS

    the second helper cell pulls out the 2 characters from the left. I then take the value of this second cell to get my number. As you can tell whenever someone scores only 1PT I am going to run into issues because the second helper is just pulling out the spaces. I tried to take the value of the first helper cell with no luck.
    Any Ideas?
    Thanks

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: pulling text from the middle of a string

    hi DRFILL. assuming data is in A1, how about:
    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",50)),50))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: pulling text from the middle of a string

    If A1 is your text then
    =TRIM(RIGHT(A1,5))

    this will use the 5 characters on the right, and then delete any spaces.
    ie 11pts or 1pts

    your second example -does that have 2 spaces? if not you will get "S 1PT"

    As long as the PTS is in upper case and is PT or PTS

    you could use =TRIM(MID(A1,FIND("PT",A1)-2,5))
    this will find PT then pull the string out starting 2 charachters to the left. And in the case of only 1 number it will remove the space.

    Hope this helps
    Sean

  4. #4
    Registered User
    Join Date
    09-15-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: pulling text from the middle of a string

    That did it thanks

+ 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