+ Reply to Thread
Results 1 to 18 of 18

How to extract multiple instances of a keyword from a cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    03-03-2006
    Posts
    27

    How to extract multiple instances of a keyword from a cell?

    I wanna extract anyt text in a call that starts with LQ1 to a length of 10 characters to an empty cell, coma delimited. Is this possible?

  2. #2
    Forum Contributor
    Join Date
    02-28-2006
    Posts
    690
    using search you can find the location (in characters in from the start) of the text LQ1

    eg text is applesLQ1pearsplumsoranges

    the search returns 7

    LEN(cellref) returns 26

    MID(cellref,7,10) returns LQ1pearspl

  3. #3
    Registered User
    Join Date
    03-03-2006
    Posts
    27
    Thanks rob, but this does not handle multiple instances of LQ1 in the text. So if I have text like applesLQ1pearsplumsoranges peacheslq1iloveanddig'em, I would like to get'em as LQ1pearspl, lq1ilovean

  4. #4
    Forum Contributor
    Join Date
    02-28-2006
    Posts
    690
    applesLQ1pearsplumsorangespeacheslq1iloveanddig'em

    search to find the first example of LQ1 (at character 7)


    in a temporary helper cell insert the formula

    =mid(textcellref,search(textcellref,"LQ1")+10,200)

    in here you will see umsorangespeacheslq1iloveanddig'em

    now do the search on this cell

    you can have as many tries as you like, you will get error messages where only one instance of LQ1, but you can trap these out using ISERROR

  5. #5
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Not exactly sure what you want, but does this help, with your text in A1, put this in B1

    =IF(LEFT(A1,3)="LQ1",LEFT(A1,3),"")

    and this in C1

    =IF(IF(LEFT(A1,3)="LQ1",LEFT(A1,3),"")="LQ1",MID(A1,4,7),"")
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  6. #6
    Registered User
    Join Date
    03-03-2006
    Posts
    27
    A better example

    FRN EMTN 08/2007 CAD10000'B1339' 4.472 08/20/2007
    Issuer: Abbey National Treasury Services plc (LSE:57AY) (IQT32033759)
    08/20/2007

    FLTG RATE NTS 8/2007 JPY100000000 4.333 08/21/2007
    Issuer: Abbey National Treasury Services plc (LSE:57AY) (IQT31942187)
    08/21/2007

    FR GTD EMTN 22/08/2007 GBP100000 'B1340' 5.758 08/22/2007
    Issuer: Abbey National Treasury Services plc (LSE:57AY) (IQT32037171)
    08/22/2007

    I need to put in the formula in a single cell to get the coma delimited list of the IQT id's

  7. #7
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Try this,

    =IF(IF(ISERROR(FIND("IQT",A1,1)),"",FIND("IQT",A1,1))="","",MID(A1,IF(ISERROR(FIND("IQT",A1,1)),"",FIND("IQT",A1,1)),11))

  8. #8
    Registered User
    Join Date
    03-03-2006
    Posts
    27
    Nope. Only gave me the first instance. - IQT32033759

  9. #9
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    I'm assumming that your sample is not in one cell here?? If it isn't, then auto-fill the formula down the column. Here's a link on auto-fill

    http://mistupid.com/viewlets/excel/xlautofill.htm

+ 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