+ Reply to Thread
Results 1 to 9 of 9

extract text from within a text string

  1. #1
    Registered User
    Join Date
    06-04-2011
    Location
    NSW Australia
    MS-Off Ver
    Excel 2007
    Posts
    43

    extract text from within a text string

    Hello

    I am trying to extract text from the following text string example. I want to return from two places after the comma, to 2 places before the N. The comma is constant, from the N in NSW to the end will always be the same number of spaces but often different text (could be NSW 2795 or NSW 2800 or Vic 3454) the other text will vary. So from this example, I want NEW YORK. The result is not on 'stock register list'! but another sheet

    28 CURUMBIN PLACE, NEW YORK NSW 2000

    I have been working with
    Please Login or Register  to view this content.
    but I just can't get it. Any suggestions?

    Cheers

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: extract text from within a text string

    Something like this, perhaps:

    =MID('stock register list'!J2,SEARCH(",",'stock register list'!J2)+2,FIND("NSW",'stock register list'!J2)-FIND(",",'stock register list'!J2)-3)

  3. #3
    Registered User
    Join Date
    06-04-2011
    Location
    NSW Australia
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: extract text from within a text string

    Andrew, that would work if NSW was constant, but it could be any one of three or four variants. The last 8 digits will always be the same length and layout ie XXX XXXX

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: extract text from within a text string

    Sorry, that's what I get for not reading posts properly

    =MID('stock register list'!J2,SEARCH(",",'stock register list'!J2)+2,LEN('stock register list'!J2)-FIND(",",'stock register list'!J2)-10)

  5. #5
    Registered User
    Join Date
    06-04-2011
    Location
    NSW Australia
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: extract text from within a text string

    Thankyou Andrew, works well. Apparantly I was very close a couple of times, but missed it by that much.

    Cheers

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: extract text from within a text string

    why is everyone better at formulas than me? The best I could do was a rather verbose:
    PHP Code: 
    =LEFT(MID('stock register list'!J2,FIND(",",'stock register list'!J2)+2,LEN('stock register list'!J2)),LEN(MID(F14,FIND(",",'stock register list'!J2)+2,LEN('stock register list'!J2)))-8

  7. #7
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: extract text from within a text string

    Kyle, possibly your formula is verbose because you've introduced cell F14 into the mix, which hadn't previously been mentioned

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: extract text from within a text string

    haha a curse on my rubbish copy and paste skills - possibly even worse than my formulas!

  9. #9
    Registered User
    Join Date
    06-04-2011
    Location
    NSW Australia
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: extract text from within a text string

    At least you have enough gumption to post a proposed fix. By the time I worked out an issue, the poster would be dead and windows 1000 operating system will be here.

+ 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