Say I have a product category lookup like so:

```
Sheet 1
Product Name | Product Category
--------------------------------------
product 1 | A
product 2 | A
product 3 | B
product 4 | A
product 5 | B
product 6 | C
```

and I also have a list of purchases which only use Product Name like this:

```
Sheet 2
Product Name | Purchase Quantity
---------------------------------------
product 1 | 35
product 4 | 10
product 5 | 5
```

I would like to produce a rollup like this:

```
Product Category | Purchase Quantity
------------------------------------------
A | 45
B | 5
C | 0
```

I’ve tried a variety of ways to solve this like:

```
SUMIF(LOOKUP('Sheet 2'!A2:A6,'Sheet 1'!A:A,'Sheet 2'!B:B), "=A", 'Sheet 2'!B2:B6)
```

```
SUMPRODUCT(LOOKUP('Sheet 2'!A2:A6, 'Sheet 1'!A:A, 'Sheet 2'!B:B)="A"*'Sheet 2'!B2:B6)
```

Excel doesn’t like the first one. It says the formula is incorrect, but I’m not seeing why. The second one yields #VALUE. Any help on this would be much appreciated. Thanks in advance!

With *A* in D2, use this as an array formula.

```
=SUM(SUMIFS(Sheet2!B$2:B$4, Sheet2!A$2:A$4, IF(Sheet1!B$2:B$7=D2, Sheet1!A$2:A$7)))
```

Array formulas need to be finished with Ctrl+Shift+Enter, not just Enter.

### Answer：

In my opinion there is no need to use complex formulas for such an easy question. Just add another column next to **Purchase Quantity** sheet 2 to get the **Product Category** and simply use **=SUMIF**. I have prepare a solution to illustrate my thoughts:

**Formula for VLOOKUP:**

```
=VLOOKUP(D2,$A$2:$B$7,2,FALSE)
```

**Formula for SUMIF:**

```
=SUMIF($F$2:$F$4,"=" & A10,$E$2:$E$4)
```

**Results:**

Tags: excelexcel