# SUMPRODUCT OR COUNT(IF ..... IF(

#### Artorius

##### Board Regular
Two columns of data. Column A = PRODUCT TYPE, COLUMN E = Region

I have a spreadsheet that needs to calculate how many "Onions" (in column A) were sold in say "South West" (in Column E).

I thought I could use....

=SUMPRODUCT(A:A="Onions")*(E:E="South West")

but that does not work.

I then tried .....

{=COUNT(IF(A:A="Onions"),IF(E:E="South West))}

but that failed too.

Any ideas? Thanks.

### Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try a Pivot Table

Ideally I need to do this without a Pivot table ..... any idea what formula I can use?

SUMPRODUCT does not accept whole column references. Try something like...

=SUMPRODUCT(--(A2:A100="Onions"),--(E2:E100="South West"))

Hope this helps!

Edit: Corrected the formula...

=SUMPRODUCT(--(A1:A1000="Onions"),--(E1:E1000="South West"))

Sumproduct doesn't allow full column referencing.....

Excellent formula, just what I needed. Many thanks ........

Is there any limitation to SUMPRODUCT? I'm wondering if I had 3 columns of data instead of 2 ... if I could do the following?

COLUMN A = Type
COLUMN E = Region
COLUMN F = QUESTION (Y/N)

So.. if I wanted Onions, South West & Y ....

=SUMPRODUCT(--(A1:A1000="Onions"),--(E1:E1000="South West")),(--(F1:F1000="Y"))

I tried it but could not get it to work ... even tried entering as an array with the {} brackets

You have to many parenthesis and one of them is closing off the sumproduct() part before including the 3rd argument:

Try:

=SUMPRODUCT(--(A1:A1000="Onions"),--(E1:E1000="South West"),--(F1:F1000="Y"))

I thought I was in trouble when I started putting brackets everywhere

Amazing ... works a treat. Many thanks .....

Replies
2
Views
234
Replies
0
Views
480
Replies
5
Views
203
Replies
2
Views
644
Replies
2
Views
219

1,217,482
Messages
6,136,905
Members
450,030
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back