+ Reply to Thread
Results 1 to 10 of 10

Formula for searching and identifying

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Formula for searching and identifying

    Hello,

    I was wondering if someone could kindly assist me.

    I've included a mock-up data, which replicates the original data. It includes sample data and sample outcome. I've also included a summary in the EXCEL file of what it is exactly I am trying to do, and which columns are applicable.

    Any help would be greatly appreciated.

    For any clarifications, concerns, questions, please do not hesitate to ask.

    Thanking you in advance for your help.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Formula for searching and identifying

    Hello again,

    Further to the sample I've enclosed, I'm wondering if it might be a good idea to insert a new column between EN and EO.

    This column can actually look at each condition within each case, find the appropriate major and minors for that case, concatenate them and return the results in the new column. Then I can use the following formula for the remaining columns and drag across:

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(EP1,$EO$2:$EO$2)))>0,"YES","NO")

    Any suggestions at all would be appreciated.

    Thank you.

  3. #3
    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,929

    Re: Formula for searching and identifying

    Using this, I get a YES in EO, EP and ES, but I dont see how you get the other Yes's?
    =IF(OR(ISNUMBER(SEARCH(EO$1,$EI2,1)),ISNUMBER(SEARCH(EO$1,$EK2,1))),"Yes","No")
    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

  4. #4
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Formula for searching and identifying

    Hi Ford,

    Thank you very much for your reply.

    I just tried out the formula for case 1. As you said, YES appears for columns EO, EP, and ES, but not for ER. The reason there is a YES for ER is because condition ACET*COD for case 1 also uses gene 4. I'm not sure if it has anything to do with the fact that that particular condition has an *?

    Thank you.

  5. #5
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Formula for searching and identifying

    I'm not sure if I create a separate thread for this, but it's in relation to the same sample.

    So, I've been trying a different approach, in which I inserted a new column between EN and EO. The new column EO was created with the intention of creating a space to concatenate all the appropriate tests per case.

    So, for example, case 1 from the sample shows DEX, ACET*COD, CYM. Based on the data in EH-EK, it should return gene 1, gene 2, gene 4, gene 5. Once the information is available in the newly created column EO, columns EP to EX will return a YES where appropriate (in this case, at 1, 2, 4, and 5).

    In order to achieve this, I've tried the following formulas in EO:

    =SUBSTITUTE(MCONCAT(IF(ISNUMBER(FIND(","&$EH$2:$EH$10&",",","&EN2&",")),","&$EI$2:$EI$10,"")),",",1) with Ctrl+Shift+Enter and


    =VLOOKUP(TRIM(LEFT(SUBSTITUTE(EN2,",",REPT(" ",20)),20)),$EH$2:$EI$10,2,FALSE)&","&VLOOKUP(TRIM(MID(SUBSTITUTE(EN2,",",REPT(" ",20)),20,20)),$EH$2:$EI$10,2,FALSE)&","&VLOOKUP(TRIM(RIGHT(SUBSTITUTE(EN2,",",REPT(" ",20)),20)),$EH$2:$EI$10,2,FALSE)

    Following this, I then use the formula:

    =IF(SUMPRODUCT(--ISNUMBER(SEARCH(EP1,$EO$2:$EO$2)))>0,"YES","NO")

    Then drag across in order to get the YES/NO response in columns EP to EX.

    For the column EO, out of the two formulas, I get nothing for the first formula. Second formula works, but I noticed the information is not complete (for example, if I were to test it out by adding an additional condition to case 1, it will replace one of the genes with the new condition and always only returns five values).

    If insight can be provided either into:

    a) A formula that can do this in one hit, similar to Ford's; OR
    b) A two part formula, as I've shown above.

    Either is fine with me, or any other suggestions you have.

    Thank you.

    EDIT: When I've tried the VLOOKUP formula in the actual dataset, I do get a #N/A, most likely deriving from the fact that there may be extraneous information in the condition name (e.g. like a number).

  6. #6
    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,929

    Re: Formula for searching and identifying

    The reason there is a YES for ER is because condition ACET*COD for case 1 also uses gene 4. I'm not sure if it has anything to do with the fact that that particular condition has an *?
    I wasnt even looking at the data in EN. If you are using ACET*COD from that column, why do you not also use DEX & CYM?
    So are you saying that the formula also needs to find those factors and find the gene number for them too? Im confused lol

  7. #7
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Formula for searching and identifying

    Hi Ford,

    Ah, no worries, I think there is a few gaps in the sample I provided.

    For case 1:

    DEX uses 1, 2, and 5.
    ACET*COD uses 4 and 7.
    CYM uses 1, 2, and 3.

    So, for case 1, I would expect the following outcome:

    1 2 3 4 5 6 7 8 9
    YES YES YES YES YES NO YES NO NO (oops, noticed I missed a couple of minors in the sample data - my apologies).

    I hope I've made sense.

  8. #8
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,367

    Re: Formula for searching and identifying

    Its hard without helper column, you can hide it if you like, not elegant ways but hope it meet your goal

    Azumi
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-27-2013
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: Formula for searching and identifying

    Hi Azumi,

    Thank you very much for sending this through.

    This works perfectly, and I can see what you did there with the helper column. The only problem though is some cases can have up to 50 conditions.

    I tried applying your formula to the original dataset, but with up to 50 conditions it got a little messy.

    Is there anything else you can suggest?

    Thank you.

  10. #10
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,367

    Re: Formula for searching and identifying

    You right, the formula not longer apropriate for your situation, maybe you try VBA section in http://www.excelforum.com/excel-programming-vba-macros/
    VBA is more powerful and wider flexibility for complex situation

    Regards
    Azumi

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Identifying an item in one col/row and searching an entire spreads
    By Bennie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  2. Identifying an item in one col/row and searching an entire spreads
    By Bennie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 AM
  3. Identifying an item in one col/row and searching an entire spreads
    By Bennie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  4. [SOLVED] Identifying an item in one col/row and searching an entire spreads
    By Bennie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  5. [SOLVED] Identifying an item in one col/row and searching an entire spreads
    By Bennie in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-18-2005, 09:05 PM

Tags for this Thread

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