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.

### Answer：

If you use `SUMPRODUCT`

you can get the required result without adding any columns, e.g.

`=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))`

### Answer：

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())`

Tags: excelexcel, function