Searching Excel Data Set based on Between Dates

时间:2016-10-20 13:22:46

标签: excel

I Have two Data Sets as Follows

Data Set One

ID        Date From        Date To
5001      06/12/1999       08/1/2000
5001      08/08/2002       09/09/2004

Data Set Two

ID          Date From        Date To      Res
5001       01/01/1999       01/01/2001     E
5001       02/01/2001       01/01/2010     O

I would like to use the ID from Data Set one to find and return the Res based on the dates. The Current Employee Has been holding the position 5001 from the specified dates in Data Set One and I would like to Match it with Data Set Two to Understand The Position Res

Note: The Data Set greater than 10,000 Rows each

1 个答案:

答案 0 :(得分:1)

看看是否至少有一个" E"或者" O"工作表2上的范围完全包含工作表1上具有相同ID的范围我将使用: -

=IF(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,"<="&C2,Sheet2!C:C,">="&B2,Sheet2!D:D,"E"),"E",IF(COUNTIFS(Sheet2!A:A,A2,Sheet2!B:B,"<="&C2,Sheet2!C:C,">="&B2,Sheet2!D:D,"O"),"O",""))

从表1的单元格D2开始。

但是为了查看Sheet 2中是否至少有一个范围与工作表1上具有相同ID的范围重叠,我会使用: -

{{1}}