简体   繁体   中英

In SUMIFS function I am getting #VALUE error

在此输入图像描述

For the top table above, I am using the following SUMIFS function:

=SUMIFS($C$3:$G$23,$A$3:$A$23,"=Cinthol",$B$3:$B$23,"=Bangalore")  

to try to get the results in the output format shown, based on two criteria {1. Product and 2. City}. But I am getting #VALUE! error.

Am I doing something wrong?

You have two issues. "each criteria_range argument must contain the same number of rows and columns as the sum_range argument" and your criteria are =Cinthol and =Bangalore .

This may directly be addressed quite easily by repeating the SUMIFS function for each of ColumnsC:G individually (and you might then sum the results).

An alternative would be to add each row up in your data set and apply a PivotTable.

If you use SUMPRODUCT you can get the required result without adding any columns, eg

=SUMPRODUCT($C$3:$G$23*($A$3:$A$23="Cinthol")*($B$3:$B$23="Bangalore"))

or with cell references to copy down a table

=SUMPRODUCT($C$3:$G$23*($A$3:$A$23=J2)*($B$3:$B$23=K2))

That assumes that there are no text values (or "formula blanks" like "") in the range C3:G23. If there are then you can still make it work like this:

=SUMPRODUCT($C$3:$G$23,ISNUMBER($C$3:$G$23)*($A$3:$A$23=J2)*($B$3:$B$23=K2))

There is a solution:

First sum_range must be a column so instead of

=SUMIFS($C$3:$**G**$23,$A$3:$A$23,"=Cinthol",$B$3:$B$23,"=Bangalore")

it should be

=SUMIFS($C$3:$**C**$23,$A$3:$A$23,"=Cinthol",$B$3:$B$23,"=Bangalore")  

to make it work.

If it's not enough you can use =SUM(SUMIFS(), SUMIFS())

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