+ Reply to Thread
Results 1 to 13 of 13

Searching for more than 1 term

  1. #1
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Searching for more than 1 term

    First post, sorry if this is the wrong section.

    I have a question about how to go about this big search I want to do in Excel. First let me explain the situation.

    I have 2 spreadsheets:

    #1 contains about 30,000 rows, each one is the name of a company.
    #2 contains about 18,000 rows, each one is the name of a company too.

    I know for a fact that #1 contains all of #2, most of the names being exact character matches (if I'm not being case sensitive).

    What I want to do is create an extra column in #1 with only one of two values: 'yes' or 'no'. 'Yes' means this row exists in #2, and 'no' obviously those that aren't in #2.

    My question: how do I get Excel to do this automatically, to save me doing ctrl-F and searching for each of the 18,000 names individually?

    Many thanks in advance to whoever will save me hours of tedious work...

    ps I have Excel 2010 not 2003 as is says in my profile.
    Last edited by RightPlace; 07-07-2011 at 10:57 AM.

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

    Re: Searching for more than 1 term

    Try something like:

    =IF(Isnumber(Match(A2,'Sheet2'!A:A,0)),"Yes","No")

    where A2 on current sheet is being searched in column A of Sheet2... adjust as necessary and copy down the list
    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
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    I forgot to mention I'm a noob too? So I'm not sure how to use the function you gave me. But I'm reading a tutorial on the IF function... thanks for your help!

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

    Re: Searching for more than 1 term

    All you have to do is copy my formula to cell that in a free column and in the same row as the first item to look up in the other table.

    Adjust the A2 in the formula to correspond to the cell reference that the first lookup item is in. Then adjust the Sheetname between single quotes to exactly match the sheet name the table is in. And change the A:A to the column reference that the match is supposed to be in...

    Then hit Enter.. and hopefully you get the expected result.

    If satisfied, click and hold the little black square at the bottom right corner of the cell with the formula in it... and drag down the list... all the formula should auto adjust to corresponding row items.

  5. #5
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    I think I'm almost there - except fo the A:A part in your formula. This refers to the column where the 18,000 names are, which is column C in this particular case. How do I fit that in the A:A syntax?

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

    Re: Searching for more than 1 term

    You can use C:C (that refers to the whole column) or you can use a more defined range like $C$1:$C$18000

  7. #7
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    Ok thanks I will try that when I'm back in the office tomorrow.

  8. #8
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    Ok, so it's not working for me at the moment. This is what the formula looks like:

    =IF(ISNUMBER(MATCH(B10,'[Sheet2]Batch 1'!C:C,0)),"Yes","No")

    where B10 is the first of the 30,000 names, amongst which there are 18,000 which are in column C of Sheet 2, in workbook Batch 1.

    It's returning a 'No' even though I did a manual Ctrl F and the name is there both in Sheet 2 and B10.

    Any idea where it went wrong?

    ps I'm very grateful for your help.



    Edit: when I press Enter after entering the formula, Excel opens a dialog box named 'update sheet values', so I click on Sheet 2. It then returned a correct 'Yes' for cell B10 but after dragging the corner of the cell down to repeat the formula, it has returned a 'Yes' incorrectly. The name is a partial match only, does this formula count partial matches as 'true'?
    Last edited by RightPlace; 07-07-2011 at 05:32 AM.

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

    Re: Searching for more than 1 term

    Are you sure about the naming: '[Sheet2]Batch 1'!?

    Are you working within one workbook? If so, you need only specify the actual sheet name, which I assume might be Batch 1

    So try:

    =IF(ISNUMBER(MATCH(B10,'Batch 1'!C:C,0)),"Yes","No")

    This formula finds exact matches only... if you want partial matches, we can add wildcards...

  10. #10
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    Yes it's all within one workbook.

    The formula IS working now but there are 2 complications:

    I realised I actually want it to look both in column C and D in Batch 1 - what's the syntax for that please?

    Also, there is a strange thing happening, maybe it's a bug? But when I click and drag the bottom right-hand corner of the first cell where I've entered the formula, it repeats 'Yes' everywhere below, even where I've manually done ctrl F to verify that the Yes should be a No. But THEN, this is the strange part, if I do F2 to edit the cell where the 'Yes' is (but it should be a 'No'), then press Enter, it corrects it to a 'No'! (or leaves it as Yes if correct).

    It seems the bottom right click and drag thing is not working. I am definitely making the little cross appear, and it is copying the formula correctly and changing the cell number for the B column. I guess I could do F2+ Enter 30,000 times....

    Dude, if I can make a donation to the site or anything, you've been amazing. Thanks.

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

    Re: Searching for more than 1 term

    Go to Tools|Options and in the Calculation tab, ensure that the Automatic checkbox is ticked....

    For checking two columns, try:

    =IF(ISNUMBER(MATCH(B10,'Batch 1'!C:C,0)),"Yes",IF(ISNUMBER(MATCH(B10,'Batch 1'!D:D,0)),"Yes","No"))

    There are a couple of preferred charities in my signature below.....

  12. #12
    Registered User
    Join Date
    07-05-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Searching for more than 1 term

    It works perfectly! Donation made, and thanks a million, if I could I would hug you right now. Problem solved.

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

    Re: Searching for more than 1 term

    Thank you!

+ 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