简体   繁体   English

当多个条件之一在数字范围内时,Excel INDEX MATCH

[英]Excel INDEX MATCH when one of multiple criteria is within a range of numbers

To identify duplicates in a large list of personal records, I'm replacing all names with a CONCATENATE of Name and Date of Birth (DOB).为了识别大量个人记录中的重复项,我将所有姓名替换为姓名和出生日期 (DOB) 的 CONCATENATE。 Here is the sheet I'm referencing (DOBs!):这是我参考的工作表(DOB!):

DOBs! -----------------------------------------
C               D           E       F       G       I            K
Name            Years       Start   End     # Yrs   DOB          NewNameDOB
Sally Adams     2014-2014   2014    2014    1       1968-1204    Sally Adams1968-1204
John Agnew      2014-2014   2014    2014    1       1979-0419    John Agnew1979-0419  
Bob Anderson    2013-2014   2013    2014    2       1965-0402    Bob Anderson1965-0402  
Antonio Andrews 2014-2014   2014    2014    1       1955-0716    Antonio Andrews1955-0716  
Julie Assan     2012-2014   2012    2014    3       1978-0805    Julie Assan1978-0805  

On the main sheet (Employees!), each person has a row of data for each active year.在主表(员工!)上,每个人都有一行数据,用于每个活跃年份。 Work 14 years, you have 14 lines of data to track.工作 14 年,你有 14 行数据需要跟踪。

Employees! -----------------------------------------
C       D               **E**                       F       G   H   I   J...
Year    Name            NewNameDOB                  Dept
2013    Julie Assan     Julie Assan1978-0805        East
1998    Mike Rogers     Duplicate in Same Year      Main
1999    Mike Rogers     Duplicate in Same Year      Main
2000    Mike Rogers     Mike Rogers1969-0510        Main
2001    Mike Rogers     Mike Rogers1969-0510        Main

As mentioned, I need to separate duplicate names from 10395 records (like Mike Rogers and Mike Rogers).如前所述,我需要从 10395 条记录(如 Mike Rogers 和 Mike Rogers)中分离出重复名称。 Employees!雇员! column E will now identify the employees as Julie Assan1978-0805 and Julie Assan1980-0131 (for example). E 列现在将员工标识为 Julie Assan1978-0805 和 Julie Assan1980-0131(例如)。

Today we take my first step, using the years they worked in order to solve 99% of the duplicates.今天,我们迈出了第一步,利用他们工作的年数来解决 99% 的重复项。 After this, only a few duplicate names will be left who worked at the same time as each other, which I'll have to handle manually.在此之后,将只剩下几个同时工作的重复名称,我将不得不手动处理。

If the Employees!如果员工! sheet has a 2013 record for "Julie Assan," then the first step is to check DOBs to find any Julie Assans who worked in 2013. My new column E in Employees!工作表上有“Julie Assan”的 2013 年记录,那么第一步是检查 DOB 以查找在 2013 年工作的任何 Julie Assans。我在员工中的列 E! will take the current 2013 record of Julie Assan, and find any matches in DOB!将采用 Julie Assan 2013 年的当前记录,并在 DOB 中查找任何匹配项! where C (name) matches Julie Assan, E <= 2013, and F >= 2013. Usually, there will be only one match, and it will tell me that is Julie Assan1978-0805.其中 C(姓名)匹配 Julie Assan、E <= 2013 和 F >= 2013。通常只有一个匹配项,它会告诉我这是 Julie Assan1978-0805。 Sometimes, there will be two Mike Rogers who worked during the same year, and it should tell me "Duplicate in Same Year".有时,会有两个 Mike Rogers 在同一年工作,它应该告诉我“同年重复”。

On the Employees!关于员工! sheet column E , I've started with this...表列 E ,我已经开始了这个......
=index(DOBs!$k$2:$k$10395,match($d3&$c3,DOBs!$c$2:$c$10395& ??? ,0) =index(DOBs!$k$2:$k$10395,match($d3&$c3,DOBs!$c$2:$c$10395&???,0)

Not sure where to go with this formula, whether that means adding "IFs" or something different.不知道这个公式去哪里,是否意味着添加“IF”或不同的东西。

edited to explain in great depth编辑以深入解释

=IF(COUNTIFS(DOBs!C$2:C$10395,Employees!D2,DOBs!E$2:E$10395,"<="&Employees!C2,DOBs!F$2:F$10395,">="&Employees!C2)>1,"Duplicate in Same Year",INDEX(DOBs!K$2:K$10395,MATCH(TRUE,IF(DOBs!C$2:C$10395=Employees!D2,IF(DOBs!E$2:E$10395<=Employees!C2,IF(DOBs!F$2:F$10395>=Employees!C2,TRUE))),0)))

Enter as an array formula by confirming with Ctrl+Shift+Enter, then autofill down.通过使用 Ctrl+Shift+Enter 确认输入数组公式,然后向下自动填充。 It first checks for duplicates using COUNTIFS, and returns "Duplicate in same year" if it is.它首先使用 COUNTIFS 检查重复项,如果是,则返回“同年重复”。 If there are not duplicates, it uses INDEX/MATCH to find the NewNameDOB.如果没有重复,它使用 INDEX/MATCH 来查找 NewNameDOB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM