简体   繁体   English

INDEX MATCH 2 列标准 [部分匹配 + 完全匹配]

[英]INDEX MATCH 2 Column Criteria [Partial Match + Full Match]

There is a sheet called "Bookings".有一张名为“预订”的表格。

Column H reflects their role H 列反映了他们的角色

  • SALES销售量
  • RECEPTIONIST接待员
  • SALES AND RECEPTIONIST销售和接待员

In the current sheet:在当前工作表中:

  • Column J, it is a Qualification role eg "SALES" or "RECEPTIONIST". J 列,它是一个资格角色,例如“销售”或“接待员”。

How can I amend the following code on index match to pull over only staff from "Bookings" who partial match Column J?如何修改索引匹配的以下代码以仅从“预订”中提取部分匹配列 J 的员工?

If someone's role is "SALES", I can get it to pull over "SALES".如果某人的角色是“销售”,我可以让它拉过“销售”。 If someone's role is "RECEPTIONIST", I can get it to pull over "RECEPTIONIST".如果某人的角色是“接待员”,我可以让它拉过“接待员”。 However, if it is "SALES AND RECEPTIONIST" as the role, it fails to pull over whether it is "SALES" or "RECEPTIONIST".但是,如果是“SALES AND RECEPTIONIST”作为角色,无论是“SALES”还是“RECEPTIONIST”都拉不过去。

Please advise how I should amend the Formula below.请告知我应该如何修改下面的公式。

=IFERROR(INDEX(Bookings!$B:$B, 
MIN( 
IFERROR(MATCH(1,($N3=Bookings!$C:$C)*($J3=Bookings!$H:$H),0),1E+99), 
IFERROR(MATCH(1,($N3=Bookings!$D:$D)*($J3=Bookings!$H:$H),0),1E+99), 
IFERROR(MATCH(1,($N3=Bookings!$E:$E)*($J3=Bookings!$H:$H),0),1E+99), 
IFERROR(MATCH(1,($N3=Bookings!$F:$F)*($J3=Bookings!$H:$H),0),1E+99), 
IFERROR(MATCH(1,($N3=Bookings!$G:$G)*($J3=Bookings!$H:$H),0),1E+99)

 )))

What I understand from your statement (your question needs some clarification):我从您的陈述中了解到的(您的问题需要澄清一下):

If someone's role is "SALES", I can get it to pull over "SALES".如果某人的角色是“销售”,我可以让它拉过“销售”。 If someone's role is "RECEPTIONIST", I can get it to pull over "RECEPTIONIST".如果某人的角色是“接待员”,我可以让它拉过“接待员”。 However, if it is "SALES AND RECEPTIONIST" as the role, it fails to pull over whether it is "SALES" or "RECEPTIONIST".但是,如果是“SALES AND RECEPTIONIST”作为角色,无论是“SALES”还是“RECEPTIONIST”都拉不过去。

Your are looking for a filter condition that considers an OR condition in case your are looking for both roles.您正在寻找一个考虑OR条件的过滤条件,以防您同时寻找这两个角色。 Here is how you can do it on cell F3 (see the screenshot below):以下是在单元格F3上执行此操作的方法(请参见下面的屏幕截图):

=LET(result, FILTER(C3:D20, 
  (C3:C20<>"") * (IF(A3="SALES AND RECEPTIONIST", 
  (D3:D20="SALES") + (D3:D20="RECEPTIONIST"), D3:D20=A3))), 
  IF(A3="","", result))

You can consider more than one filter condition via FILTER function.您可以通过FILTER function 考虑多个过滤条件。 Simulating AND condition with multiplication ( * ) and OR condition with addition ( + ).用乘法 ( * ) 模拟AND条件,用加法 ( + ) 模拟OR条件。 Each condition evaluates to 0 or 1 , for the same range of the first input argument of FILTER , so this is how you achieve it.对于FILTER的第一个输入参数的相同范围,每个条件的计算结果为01 ,因此这就是您实现它的方式。 I excluded empty rows to consider a more general case.我排除了空行以考虑更一般的情况。 The LET function is used for easy reading. LET function 用于方便阅读。 Here is the screenshot:这是屏幕截图:

示例 excel 文件

In the cell A3 I have a list ( Data->Data Validation->Allow with the option List ) with the following values: SALES,RECEPTIONIST,SALES AND RECEPTIONIST , so you can dynamically filter by your roles.在单元格A3中,我有一个列表( Data->Data Validation->Allow选项List ),其中包含以下值: SALES,RECEPTIONIST,SALES AND RECEPTIONIST ,因此您可以按角色动态过滤。

I hope it helps to use it on your real problem.我希望它有助于在您的实际问题上使用它。

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

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