+ Reply to Thread
Results 1 to 4 of 4

Conditional VLookup

  1. #1
    Registered User
    Join Date
    07-25-2009
    Location
    Los angeles
    MS-Off Ver
    Excel 2007
    Posts
    2

    Conditional VLookup

    All,

    This is my first post, looks to be a lot of really knowledgable people on here. So here we go.

    I have 2 Columns in sheet1:

    A - CIK
    B - Date

    In Sheet2
    A - CIK
    B - Date

    For each row in Sheet1, I need to find if for a given CIK, date, if there is at least row with the same CIK with a date that is within 60 days before the said date in sheet1. If so, mark the row, "Found" in a new column for sheet1.

    For example, for CIK=1, date=march 20, 2009, there could be many rows with CIK=1 in sheet2, but there should at least one between jan 20 2009 and march 20 2009, with the same CIk in sheet2. If so, mark the row "Found" in sheet1 or that row. Repeat this for all rows in sheet 1.

    The two files contain atleat 70,000 rows each. So this should be fast.

    I have done a lot of searching, but cannot seem to find the answer to these.

    I appreciate the help.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional VLookup

    Hi and welcome to the board,
    if CIK and date in columns A and B on sheet 1 and also on sheet 2 this formula should help

    =IF((SUMPRODUCT(--(Sheet2!A2:A9=Sheet1!A2);--(Sheet2!B2:B9>=(Sheet1!B2)-60)))>=1;"found";"")

    Replace ; with , if needed

    Adapt the ranges to your needs

  3. #3
    Registered User
    Join Date
    07-25-2009
    Location
    Los angeles
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Conditional VLookup

    Thanks for your solution. It works but with 70,000 rows it gets slow. Any ideas on mkaing it faster?

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional VLookup

    2007 has a sumifs function that might be faster

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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