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

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176
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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176
Ideally I need to do this without a Pivot table ..... any idea what formula I can use?
 

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,697
SUMPRODUCT does not accept whole column references. Try something like...

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

Adjust the range accordingly.

Hope this helps!

Edit: Corrected the formula...
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828

ADVERTISEMENT

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

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

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176

ADVERTISEMENT

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
 

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
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"))
 

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176
I thought I was in trouble when I started putting brackets everywhere :)

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

Forum statistics

Threads
1,136,621
Messages
5,676,852
Members
419,656
Latest member
lironprofit

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top