简体   繁体   English

具有多个条件数组的Sum公式中的Excel单元格引用

[英]Excel Cell References in Sum Formula with Multiple Condition Array

Is it possible to put cell references inside an array that is being used with in a GetPivotData formula, encapsulated by a SUM? 是否可以将单元格引用放在由SUM封装的GetPivotData公式中正在使用的数组内?

For example, this formula works 例如,此公式有效

=SUM(GETPIVOTDATA("loss_pct",Pres3_Pivot!$A$1,"typeOfLiquidation",{"REO Sale","Short Sale"},"liquidationMonth",E$6))

It take the sum of the GetPivotData result for the "typeofLiquidation" values "REO Sale" and "Short Sale" 它使用“ typeofLiquidation”值“ REO Sale”和“ Short Sale”的GetPivotData结果之和

This formula does not work: 该公式不起作用:

=SUM(GETPIVOTDATA("loss_pct",Pres3_Pivot!$A$1,"typeOfLiquidation",{D23,D24},"liquidationMonth",E$6))

This attempts the same result, but with cell references at 'D23' and 'D24.' 这将尝试相同的结果,但单元格引用位于“ D23”和“ D24”。 Attempting to enter this formula is met with an application error telling me the formula I typed contains an error. 尝试输入此公式时遇到应用程序错误,告诉我键入的公式包含错误。

This also does not work, but this time at least I get a reference error: 这也行不通,但这次至少我得到一个参考错误:

=SUM(GETPIVOTDATA("loss_pct",Pres3_Pivot!$A$1,"typeOfLiquidation",INDIRECT({"D23","D24"}),"liquidationMonth",E$6))

Does anyone have a suggestion? 有人有建议吗? Is such a reference inside the array possible? 数组内的这种引用可能吗?

So I found a solution. 所以我找到了解决方案。

This formula works (entered as an array [Ctrl+Shft+Enter]): 该公式有效(输入数组[Ctrl + Shft + Enter]):

=SUM(GETPIVOTDATA("loss_pct",Pres3_Pivot!$A$1,"typeOfLiquidation",U23:U24,"liquidationMonth",E$6))

The key was referencing cells U23:U24 where I can transformed the actual references (D23:D24) into Text(). 关键是引用单元格U23:U24,在这里我可以将实际引用(D23:D24)转换为Text()。 This was a requirement for the GetPivotData to work even without the sum and the array component. 即使没有sum和array组件,这也是GetPivotData起作用的要求。

Entered as an array formula (Ctrl+Shft+Enter), it works. 作为数组公式输入(Ctrl + Shift + Enter),它可以工作。 Thanks pnuts! 谢谢你!

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

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