简体   繁体   中英

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. 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.

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.

I have even tried using INDIRECT to print the strings, {INDIRECT($K$3), INDIRECT($K$4)} alas to no avail.

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.

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.

But if the values are in one column, K3:K8 for example, then TRANSPOSE(K3:K8) will be exactly the same row vector.

TRANSPOSE will only work in array context. 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. The curly brackets should then appear automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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