Forum Discussion

DPifarre's avatar
DPifarre
Copper Contributor
Jun 03, 2020
Solved

Return value based on multiple critieria

Hi,

I'm trying to return the WSR rule (Work Schedule Roster) that applied to an individual on a given date. The first table is my expected result for the given values in the data table. 

 Pers.No.9-Feb-2012-Feb-203-Nov-20 
 100075N0400015A0300015A030001 
 100555N0100015N0100015A030001 
Data table    
Pers.No.Last nameFirst nameWS ruleStart DateEnd Date
9994BrownMary5A0400019-Jan-1231-Dec-99
9998JonesPhillip5D2200011-Apr-1831-Dec-99
10007ObamaTracey5N0400016-Jun-1110-Feb-20
10007ObamaTracey5A03000111-Feb-2031-Dec-99
10055ChangBen5N01000118-Apr-162-Oct-20
10055ChangBen5A0300012-Nov-2031-Dec-99
  • DPifarre Please see the attached file. Your data will stay in a table named Data on Tab Data and the result of look up will be on Tab Output. Note that I have corrected your End date to the year 9999 instead of 1999 as currently.

    I use Index/Match array formula to look up. Basically, it will look at the Data Table, try to find the intersection of column 4 where your WS Rule stays and the row where all conditions of (Person ID, Start date <= your lookup date, End date >= your look up date) are satisfied. 

14 Replies

  • hynguyen's avatar
    hynguyen
    Iron Contributor

    DPifarre Why 10007 with the date of 12 Feb shows 5N040001 in your expected result? Should it show 5A030001 instead because 12 Feb belongs to the duration starting on 11 Feb?

    Similarly, 10055 with the date of 12 Feb showing 5A030001 in your expected result. Should it show 5N010001 instead because 12 Feb belongs to the duration ending on 2 Oct?

    If you could confirm your rule, the formula to pull the desired result would not be a problem.

    • DPifarre's avatar
      DPifarre
      Copper Contributor

      hynguyen 

      Yes you are correct I incorrectly assigned the responses. Expected result should be:

      Pers.No.9-Feb-2012-Feb-203-Nov-20
      100075N0400015A0300015A030001
      100555N0100015N0100015A030001

       

      I appreciate your pickup and assistance

      • hynguyen's avatar
        hynguyen
        Iron Contributor

        DPifarre Please see the attached file. Your data will stay in a table named Data on Tab Data and the result of look up will be on Tab Output. Note that I have corrected your End date to the year 9999 instead of 1999 as currently.

        I use Index/Match array formula to look up. Basically, it will look at the Data Table, try to find the intersection of column 4 where your WS Rule stays and the row where all conditions of (Person ID, Start date <= your lookup date, End date >= your look up date) are satisfied. 

Resources