简体   繁体   English

如何改善查找(找到最后一个相关项目)?

[英]How can this lookup (find the last relevant item) be improved?

One of the reports that wastes a bunch of my time at work is the Roster. 名册是浪费我大量时间的报告之一。 It's a multi-site, multi-contract listing of every employee currently assigned to a specific client. 这是当前分配给特定客户的每个员工的多站点,多合同列表。 Currently, it has a little over 6,000 lines by 20-something columns, indexed against 3 different datasets. 当前,它由20多个列组成的6,000行多一点,针对3个不同的数据集进行索引。 Not the largest mess in the world, but still a pain. 这不是世界上最大的混乱,但仍然很痛苦。 And it's almost all in excel, because I somehow don't have a business case for Access. 而且这几乎全都在excel中,因为我不知何故没有Access的业务案例。

But one part of this monster stands apart. 但是这个怪物的一部分与众不同。 One tab per site Site Totals , listing off every time any agent has gone through training. 每个站点“ Site Totals一个选项卡,列出任何代理商经过的每次培训。 A second tab (again, one per site) Site Data displaying only the most recent training class, and the credentials they had during that class. 第二个标签(同样,每个站点一个)“ Site Data仅显示最新的培训课程,以及他们在该课程中拥有的凭据。

That second tab is driven by variations of this array formula - Last_Row is a named range on another tab, and column A is a pivot of the UID column on Site Totals . 第二个选项卡由此数组公式的变形驱动-Last_Row是另一个选项卡上的命名范围,列A是“ Site Totals ”上UID列的枢轴。 I've broken it apart for readability: 为了便于阅读,我对其进行了分解:

=IF(INDEX('Site Totals'!B:B,LARGE(($A2=INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row))*
 (INDIRECT("'Site Totals'!B1:B"&Last_Row)<>"")*
 ROW(INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row)),1))="Trainer",
 "",
 INDEX('Site Totals'!B:B,LARGE(($A2=INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row))*
 (INDIRECT("'Site Totals'!B1:B"&Last_Row)<>"")*
 ROW(INDIRECT("'Site Totals'!$A$1:$A$"&Last_Row)),1)))

I know what this formula does, but I don't know how to improve it. 我知道这个公式能做什么,但我不知道如何改善它。 This formula needs to be changed, because it currently is on the order of 500 Million calculations (I'm not allowed to delete historical data), and it takes me 3 hours to calculate the workbook ... if it doesn't crash Excel first. 该公式需要更改,因为当前它的计算量约为5亿次(不允许删除历史数据),并且需要3个小时才能计算出工作簿...如果不崩溃,Excel第一。

I'm open to VBA and / or custom functions, but would prefer to have native Excel functions. 我愿意使用VBA和/或自定义函数,但希望使用本机Excel函数。 I'm not able to install anything, so any solution must be native Excel, and Must be compatible to Excel 2007. 我无法安装任何东西,因此任何解决方案都必须是本机Excel,并且必须与Excel 2007兼容。

If your source is a pivot table, try is the GETPIVOTDATA function. 如果您的源是数据透视表,请尝试使用GETPIVOTDATA函数。 You might be able to accomplish what you want without INDIRECT and INDEX . 如果没有INDIRECTINDEX您也许可以完成所需的工作。

What i have understood is that every person has/has not attended a training and you want to retrive the name of that training, in case he has not, you want a blank space in the cell. 我了解的是,每个人都曾/未曾参加过一次培训,并且您想检索该培训的名称,以防万一他没有参加,您想要在单元格中留一个空白。 If this description is correct you can try this formua, press ctrl+shift+enter to execute. 如果此说明正确,则可以尝试使用此形式,请按ctrl + shift + enter执行。

=IFERROR(INDEX('Site Totals'!B$1:B$12,MATCH(A2&"Trainer",'Site Totals'!A$1:A$12&'Site Totals'!B$1:B$12)),"")

Here A2 contians the name of the person. 在此,A2代表人的名字。 I can be more precise with this formula if you can provide some sample data butI would recommend to not to use entire B & Columns in Site Total workssheete as this will definately slow down computing process, instead you can use B1:B8000 or smaller range, to speed up process. 如果您可以提供一些示例数据,则可以更精确地使用此公式,但是我建议不要在Site Total工作表中使用整个B和列,因为这肯定会减慢计算过程,而可以使用B1:B8000或更小范围,加快流程。 Hope that helps. 希望能有所帮助。

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

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