简体   繁体   English

Excel公式SUMIFS使用数组范围内的单元格值

[英]Excel formula SUMIFS use cell value in array range

I am using a SUMIFS formula in an excel document, and one part of the formula is an array to check if one value meets a number of criteria. 我在Excel文档中使用SUMIFS公式,该公式的一部分是一个数组,用于检查一个值是否满足多个条件。 However the data in the array is typed out manually, eg {"Nike", "Amazon"} , however I would like to use a cell value instead of the exact string, ie {$K$3, $K$4} but excel does not allow that. 但是,数组中的数据是手动输入的,例如{"Nike", "Amazon"} ,但是我想使用单元格值而不是确切的字符串,即{$K$3, $K$4}但是excel确实可以不允许那样。

The formula I am using at the moment is as follows: 我目前使用的公式如下:

=SUM(SUMIFS(INDIRECT(C$2&"[Allocation per Account]"),INDIRECT(C$2&"[Team]"),$J$3,INDIRECT(C$2&"[Role]"),$B3,INDIRECT(C$2&"[Account]"),{"Nike","Thirdbridge","Amazon","EIB","Smith & Nephew","ARUP"}))

Where by the match of the table range [Account] is set by typing out each value separately. 通过匹配表范围,可以通过分别键入每个值来设置[Account]

I have even tried using INDIRECT to print the strings, {INDIRECT($K$3), INDIRECT($K$4)} alas to no avail. 我什至尝试使用INDIRECT打印字符串, {INDIRECT($K$3), INDIRECT($K$4)}都无济于事。

Is there a way to change these values to cell references? 有没有办法将这些值更改为单元格引用?

{"Nike","Thirdbridge","Amazon","EIB","Smith & Nephew","ARUP"} is an array literal for a row vector. {"Nike","Thirdbridge","Amazon","EIB","Smith & Nephew","ARUP"}是行向量的数组文字。

So if the values (strings in that case) would be in one row, K3:P3 for example, then K3:P3 would be exactly the same row vector. 因此,如果值(在这种情况下,字符串)。将一排, K3:P3例如,然后K3:P3将是完全相同的行向量。

But if the values are in one column, K3:K8 for example, then TRANSPOSE(K3:K8) will be exactly the same row vector. 但是,如果值在一列中,例如K3:K8 ,则TRANSPOSE(K3:K8)将是完全相同的行向量。

TRANSPOSE will only work in array context. TRANSPOSE仅在数组上下文中工作。 So you have to input your formula as an array formula: 因此,您必须输入公式作为数组公式:

{=SUM(SUMIFS(...,TRANSPOSE($K$3:$K$8)))}

To input an array formula put it into the cell withot the curly brackets. 要输入数组公式,请将其放在带有大括号的单元格中。 Then press [Ctrl]+[Shift]+[Enter] to confirm. 然后按[Ctrl] + [Shift] + [Enter]确认。 The curly brackets should then appear automatically. 大括号应该会自动出现。

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

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