+ Reply to Thread
Results 1 to 8 of 8

Lookup/match in multiple columns meeting criteria

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Lookup/match in multiple columns meeting criteria

    I have a very large database (4 separate columns) with between 400,000 and 600,000 rows and I need to lookup a registration number in each one and if 2 or more events happened on the same date then return 1 as 'meeting criteria.'

    I made an example sheet with the expected output. Column Q has the Lookup value and R has the expected output. So basically, the number in Q should be looked up in A, E, I, and M and then if the MEAS_DATE is the same and MEETS_CRITERIA =1 in 2 or more columns, then the output should be 1.

    I have tried to figure out a way to do this with what knowledge I have of excel but am struggling to figure out how do this. any help would be appreciated.

    Example_factors.xlsx

  2. #2
    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,933

    Re: Lookup/match in multiple columns meeting criteria

    I think we need to do this in stages, Im a little unclear on how you need the match on DATE and CRITERIA to work.
    This will test for more than 1 "number" being in that row (it returns TRUE/FALSE at the moment, until we get the other 2 sorted out)...
    =COUNTIF(A2:O2,Q2)>1
    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

  3. #3
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Lookup/match in multiple columns meeting criteria

    Let me try to give a better explanation. The code you wrote will indeed check for more than 1 number in the row. The problem is that each of the 4 columns of information are not always lined up exactly with the same 'person' in each row.

    So "Factor A_REG_NO", "Factor B_REG_NO", etc are people who have had this Factor checked on them on a particular date. Not everyone will have had the factor checked; therefore, the rows won't line up exactly across all 4 columns. Thats why I was trying to use the "master list" of "REG_NO" called "LOOK-UP REG NO" to go through each column of data, and then find whether a factor was checked on the same day. If so, then if any 2 of Factor A, B, C, or D are equal to 1, to return in the output a 1.

    What I am imagining happening is the following: for Lookup-REG NO 127086579, it starts in column A and finds 3 occurences of the Lookup-reg no, these are on 1/15/2008, 1/16/2008, and they each 'Meet criteria" meaning they have a 1 in column C. The code should then look into column E and find the same lookup-reg no and it would find a number of occurences, none of them have a 1 on any day that column C had. When the code then looks into the factor C columns, it will find a 1 occuring also on 1/16/2008;therefor the output should be 1.

    Hope that is understandable.

  4. #4
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Lookup/match in multiple columns meeting criteria

    If this is not possible to do in Excel, I also can try and use other software if people have suggestions.

  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,933

    Re: Lookup/match in multiple columns meeting criteria

    I can get a match (or no match) for the "Factor A_REG_NO" and "Factor A_MEETS_CRITERIA", but will you always be comparing against the date in C, or could that be any date in any of the columns?

  6. #6
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Lookup/match in multiple columns meeting criteria

    Yeah the dates have to match. For each REG_NO, if any 2 Factors_meet criteria on the same day, then the output should be 1.

  7. #7
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Lookup/match in multiple columns meeting criteria

    And it could be any of the dates in the 4 columns of information.

  8. #8
    Registered User
    Join Date
    02-05-2012
    Location
    Honolulu, HI
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Lookup/match in multiple columns meeting criteria

    What code are you using for the matching on reg and date? One thing I could do is remove all the people with a 0 for "meeting factor" since those don't matter. Then I could just match on Reg NO and date and if two or more match then the output would be 1).

+ 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. Lookup across a row and sum values in columns that match row criteria?
    By Reanon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-12-2013, 01:43 AM
  2. Replies: 21
    Last Post: 07-12-2012, 07:44 PM
  3. Replies: 3
    Last Post: 03-25-2012, 12:56 AM
  4. Multiple Criteria Lookup/Match/Index
    By Kasz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2011, 09:30 AM
  5. lookup and count if meeting criteria
    By reghu in forum Excel General
    Replies: 6
    Last Post: 09-09-2010, 07:41 AM

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