+ Reply to Thread
Results 1 to 3 of 3

Cross reference with multiple instances in reference data

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    12

    Cross reference with multiple instances in reference data

    I am an excel newbie and need some help from experienced users. This is part of a medical audit (although all data in the attached sheet is completely fictitious).

    In sheet 1 there is data with three columns - an unique identifier (ID), and two dates (IN & OUT). In sheet 2 there are two columns - ID and a date (eDate).

    I would like in column C of sheet 2 to look at the data in sheet 1 and say for each ID is the eDate is between the IN and OUT dates. ID's may appear more than once in both sheets but for the same ID in sheet 1 the IN & OUT dates may be consecutive but do not overlap.

    A sample workbook with the correct column titles but fictitious data is attached. In red I have shown the output I am trying to achieve! I've been trying to use an array but can't get it to work.

    Thank you in advance for your help with this.
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Cross reference with multiple instances in reference data

    hi Nick F, welcome to the forum. not sure if you are using Excel 2003 or 2011 as stated in your profile. COUNTIFS only available in 2007 & above:
    =COUNTIFS(Sheet1!$A$2:$A$10,A2,Sheet1!$B$2:$B$10,"<="&B2,Sheet1!$C$2:$C$10,">="&B2)

    but if you need to use it in 2003 & below, then:
    =SUMPRODUCT((Sheet1!$A$2:$A$10=A2)*(Sheet1!$B$2:$B$10<=B2)*(Sheet1!$C$2:$C$10>=B2))

    extend range if needed

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    05-07-2013
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    12

    Re: Cross reference with multiple instances in reference data

    Thank you so much. That worked a treat.

    I'm currently using Excel 2011 on a Mac but have 2003 at work. I therefore went for the Sumproduct solution.

+ 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