+ Reply to Thread
Results 1 to 8 of 8

VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    Amsterdam
    MS-Off Ver
    latest
    Posts
    11

    VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    Hi All!

    I am struggling with a formula where I think I need an Vlookup & IF & OR statements for, but I am not sure.
    So this is the situation:

    Dataset 1:
    Column A: Title
    Column B: Date
    Column C: Where the Formula should show a Number or UNKNOWN

    Dataset 2:
    Column A: Title
    Column B: Start Date
    Column C: End Date
    Column D: Number

    I want it to work like this: If the title in Dataset 1 matches the title in Dataset 2 AND (if the Date from Dataset 1 falls between the start and end date from Dataset 2 OR the date from Dataset 1 falls after the startdate from dataset 2 and the enddate from dataset 2 is empty), I want to show the number (Column D) from dataset 2. If else: show the word 'UNKNOWN'.
    =IF(ISNA(MATCH($A2,'[Dataset 2.xlsx]Sheet1'!$A:$A,0)),"not present",

    IF(AND($B2>=VLOOKUP($A2,'[Dataset 2.xlsx]Sheet1'!$A:$D,2,FALSE),

    OR(ISEMPTY($B2); $B2<=VLOOKUP($A2,'[Dataset 2.xlsx]Sheet1'!$A:$D,3,FALSE))),

    VLOOKUP($A2,'[Dataset 2.xlsx]Sheet1'!$A:$D,4,FALSE),"UNKNOWN"))
    I tried changing the formula to this, but for some reason its not working properly.



    I Added two dummy datasets to show what should happen > Dataset 2_NEW.xlsxDataset 1_NEW.xlsx

    Please help !

    Thanks.

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    Try these
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    See the file Dataset 1_NEW(1).xlsx

  3. #3
    Registered User
    Join Date
    12-23-2015
    Location
    Amsterdam
    MS-Off Ver
    latest
    Posts
    11

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    With that formula I lose information whether the data is Not Present or Unknown. The third condition should split up in ">= Enddate OR empty cell". I tried the formula shown below. It doenst give an error, but its not working either..

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-23-2015
    Location
    Amsterdam
    MS-Off Ver
    latest
    Posts
    11

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    Can anyone help?

  5. #5
    Registered User
    Join Date
    12-23-2015
    Location
    Amsterdam
    MS-Off Ver
    latest
    Posts
    11

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    I just tried this formula anyhow, but I noticed that it SUMS the numbers of the row with the same names in it. So for example, If I have 'Carl' twice and the first number says 7 and the other one says 11, then it gives me 18.. This shouldnt happen. It should look at the dates and create the number that is in that row.

    Does anyone have a solution?

  6. #6
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    I dont understand.
    With the data that you present in "Dataset 1_New" my formula produces the results that were expected by you.
    Please include the situation that causes error.

  7. #7
    Registered User
    Join Date
    12-23-2015
    Location
    Amsterdam
    MS-Off Ver
    latest
    Posts
    11

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    Hi Jose,

    Thanks for getting back at me (!)

    The errors are shown in the files attached Dataset 2_NEW.xlsxDataset 1_NEW.xlsx. I made 2 columns: 1 showing what I want it to show, and another one with your calculation in it. I hope this clarifies what Im looking for.

    Hope you (or someone else) can help.

  8. #8
    Registered User
    Join Date
    09-24-2015
    Location
    Delhi, India
    MS-Off Ver
    MS Office 2013
    Posts
    65

    Re: VLOOKUP + IF + OR with 4 conditions, using 2 datasets.

    Hi EndeHerc,

    see the attached excel file if it will work for you.

    Thanks
    Rohit
    Attached Files Attached Files

+ 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] VLOOKUP + AND/IF with 3 conditions, using 2 datasets.
    By EndeHerc in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-05-2016, 10:58 AM
  2. [SOLVED] VBA vlookup conditions
    By yukioh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2015, 01:28 PM
  3. [SOLVED] Excel 2007 - vlookup/index/match with two datasets on two sheets
    By deevusone in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-23-2014, 04:47 PM
  4. [SOLVED] Vlookup - Country conditions (Multiple conditions)
    By dluhut in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-26-2013, 11:42 AM
  5. Vlookup with 2 conditions
    By misterno in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2013, 03:27 PM
  6. How do you do a VLookup with two conditions?
    By ryesworld in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-28-2005, 07:00 PM
  7. [SOLVED] Vlookup using 2 conditions
    By Jambruins in forum Excel General
    Replies: 3
    Last Post: 11-15-2005, 10:20 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