index-small-if具有来自同一列的多个标准

时间:2015-04-23 17:24:19

标签: excel indexing

我有以下index-small-if数组公式,如果我有一个条件= SalesOrderId,那么效果很好。

=IFERROR(INDEX(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line,SMALL(IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId]=SalesOrderId,ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1),ROWS(A$28:A28)),13),"")

现在,如果我有第二个标准叫" SalesOrderId2"查找与第一个标准相同的数据我无法使其显示来自单元格A28的两个标准的结果。

1 个答案:

答案 0 :(得分:0)

你声明你有一个有效的配方,但在我看来,现有的配方有问题,或者是为了一个非常特殊的目的而设计的。无论如何,我会接受你想要的那个。

您尚未透露此添加的条件是否应为ANDOR种类,因此此处既可以使用也可以替代。

对于 [SalesOrderId] = SalesOrderId AND [SalesOrderId2] = SalesOrderId,

=IFERROR(INDEX(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line, SMALL(IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId]=SalesOrderId, IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId2]=SalesOrderId, ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1)), ROWS(A$28:A28)), 13),"")

对于 [SalesOrderId] = SalesOrderId OR [SalesOrderId2] = SalesOrderId,

=IFERROR(INDEX(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line, SMALL(IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId]=SalesOrderId, ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1, IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId2]=SalesOrderId, ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1)), ROWS(A$28:A28)), 13),"")

在重新阅读您的问题之后,我发现我可能已经翻过了列名称和标准。如果您实际上正在寻找更接近For table [SalesOrderId] = SalesOrderId OR table [SalesOrderId] = SalesOrderId2,

=IFERROR(INDEX(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line, SMALL(IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId]=SalesOrderId, ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1, IF(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId]=SalesOrderId2, ROW(Table_michael_pc_inflowsql_inFlow_SO_SalesOrder_Line[SalesOrderId])-1)), ROWS(A$28:A28)), 13),"")

我确定你知道,数组公式需要用 Ctrl + Shift + Enter↵来完成。< / p>

顺便说一下,您可以使用上下文菜单命令“表格工具”→“设计”►“属性”►“表格名称”重命名表格,以便样本公式不会混淆。