+ Reply to Thread
Results 1 to 13 of 13

If a cell in column contains a text string, need to extract the data from adjacent cell.

  1. #1
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    If a cell in column contains a text string, need to extract the data from adjacent cell.

    Good Afternoon,

    I have been racking my brain trying to figure out this formula. What I am in need of is a way to see if a certain text string is present in column "k", for example. And if it is present I need to extract the data from column "H", in the same cell. For example, If K1 contains the text "clock tour completed" anywhere in the cell, i need to extract the data from that SAME Cell, but in column "H" and i need to do it close to 1,000 times. So there should be around 1,000 cells that contain the text "clock tour completed" somewhere in the cell. and i need to know the value in column H for that same cell, the same amount of times.

    Regards,

    JDSmith

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    Try:

    =IF(ISNUMBER(SEARCH("clock tour completed",K1)),H1,"")

    copied down
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    It's not showing any data at all.. keep in mind that while I'm looking for the text "clock tour completed", the actual text that is represented is "Random Patrol Tour Completed: Hammond Tour Pod 1E". Am I able to just look for the "clock tour completed" part of that text string or does it need to search for that ENTIRE string?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    the word "clock" doesn't appear in the sample string??? so it doesn't match... do you just want to search "tour completed"? If so remove the word "clock" from my formula.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    the word "clock" does not appear in the text you are searching in, so searching for "clock tour completed" will return nothing. refine your search parameter to something (any part) that is actually IN the text you are searching in, then try again
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    Thanks so much that did it.. Now i have one more problem to deal with.. I also need that formula to pick up with it says "tour completed with errors", as well as "
    hammond tour 1E" is that possible?

  7. #7
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    Correction:

    I need it to search by the criteria "tour completed" and also "1E". so if it does not have both of those present it will be blank. is it possible to do that? Thanks..

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    if it needs to have both (as opposed to either 1), include the addtional criteria using the and() function...because i am not sure what the completed formula looks like now, adapt the suggestion below to fit into your formula

    ...rest of your formula...and(cell ref="tour completed","1E"),rest of your formula...

    let me know how you make out

    edit: if only 1 of the conditions needs to be met, replace the "and" with "or"

  9. #9
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    The formula is like this:

    =IF(ISNUMBER(SEARCH(" tour completed",K11)),H11,"")

    so in addition to the "tour completed", i need it to search for "1E"

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    ok, try this and let me know how you make out...

    =IF(and(ISNUMBER(SEARCH(" tour completed",K11)),isnumber(search("IE",K11))),H11,"")

  11. #11
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    Now it's just coming up blank, even in a cell where it should theoretically pull the data.. Not sure whats going on now..

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    do both of the valures have to be present, or only 1 or the other?

    if only 1 or the other has to be there, change the "and" to "or"

  13. #13
    Registered User
    Join Date
    09-14-2012
    Location
    garner, NC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    They both have to be present. Maybe there is an easier way to do it.

    All i need is a formula to read the text in column "K". and if the cell in column "k" contains the text, "tour completed" AND the text "1E", i need it to show the value in column "H" of the same row. example, if cell k11 says "Patrol tour completed, Hammond Tour 1E", then i need it to show the value in cell H11..

    Maybe you know a better formula all together?

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: If a cell in column contains a text string, need to extract the data from adjacent cel

    hmmm ok tryy this?

    =IF(ISNUMBER(SEARCH("tour completed*1E",A1,1)),H11,"")

+ 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