简体   繁体   English

EXCEL:使用索引/匹配创建具有多个结果的数组公式

[英]EXCEL: Create Array Formula out of INDEX/MATCH with multiple results

my aim is to convert a massive excel sheet with different projects, employees and hours worked per month into an overview per employee.我的目标是将包含不同项目、员工和每月工作时间的大型 excel 表转换为每个员工的概览。 It should be possible to display the projects the employee is involved in and how many hours he worked per project per month.应该可以显示员工参与的项目以及他每个月每个项目工作的小时数。 The original sheet looks something like this:原始工作表如下所示:

在此处查看简化的 Excel 表

I managed to find the projects Person A worked in by filtering through the INDEX/MATCH function.我通过过滤 INDEX/MATCH function 设法找到了人 A 从事的项目。 I applied the formula to the whole row where the employees are listed and receive multiple results of projects.我将公式应用于列出员工并收到多个项目结果的整行。 My question is how to transform the formula into something more effective to copy all of the matched results (projects) into a column (see 1 ).我的问题是如何将公式转换为更有效的公式,以将所有匹配的结果(项目)复制到一列中(参见1 )。

This is what I have so far, if matches the employee name in a certain area;这是我到目前为止所拥有的,如果与某个区域的员工姓名匹配; the output is the first match of the project he is involved in: output是他参与的项目的第一场比赛:

=INDEX(B2:J3;1;MATCH("Person A";Sheet1:B3;E3;0))

How can I copy this to the bottom cells to copy all of the matched results?如何将其复制到底部单元格以复制所有匹配的结果? Does it help to create an array formula with this?用这个创建一个数组公式有帮助吗?

You can use he following formula in cell B9:您可以在单元格 B9 中使用以下公式:

=IFERROR(INDEX($2:$2,SMALL(IF($3:$3=$B$8,COLUMN($3:$3)-COLUMN(INDEX($3:$3,1,1))+1),ROWS(A$1:A1))),"")

It indexes row 2 and looks for the column number of the first match in row 3 that equals the value in B8 (=Person A).它对第 2 行进行索引,并在第 3 行中查找与 B8 (=Person A) 中的值相等的第一个匹配项的列号。 When dragging down it will look for the second match ROWS(A$1:A1) will become ROWS(A$1:A2) = 2.向下拖动时,它将寻找第二个匹配ROWS(A$1:A1)将变为ROWS(A$1:A2) = 2。

For Person B you can use this formula in cell B14:对于人 B,您可以在单元格 B14 中使用此公式:

=IFERROR(INDEX($2:$2,SMALL(IF($3:$3=$B$13,COLUMN($3:$3)-COLUMN(INDEX($3:$3,1,1))+1),ROWS(A$1:A1))),"")

I hope this is what you where looking for.我希望这就是你要找的东西。

PS if you paste the following formula in cell C9 you will get the sum result for Person A on Project XY in month 10 2019: =IF(OR($B9="",C$8=""),"",SUMPRODUCT(($B$2:$K$2=$B9)*($B$3:$K$3=$B$8)*($A$4:$A$6=C$8),B4:K6)) PS 如果您在单元格 C9 中粘贴以下公式,您将在 2019 年 10 月获得项目 XY 中人员 A 的总和结果: =IF(OR($B9="",C$8=""),"",SUMPRODUCT(($B$2:$K$2=$B9)*($B$3:$K$3=$B$8)*($A$4:$A$6=C$8),B4:K6))

Note: That is provided that the value in cell C8 equals the value in cell A4.注意:前提是单元格 C8 中的值等于单元格 A4 中的值。

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

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