Adding sumifs with an or?

ScottyLawrenceCO

New Member
Joined
Mar 23, 2011
Messages
7
I have a worksheet with two Sheets: 1 sheet for my report, and another with my Sales database. The database has brand names of products in column A and number of units sold in column B. I need to sum items by category by adding up all the sales of each brand name.

My Units Sold Formula on my report is several SUMIF() functions strung together:

Example: =SUMIF(Sales!A:A,"Huffy",Sales!B:B)+SUMIF(Sales!A:A,"Panasonic",Sales!B:B)+SUMIF(Sales!A:A,"RideKing",Sales!B:B)

Since some of the products have 25 or 30 brand names, these formulas become a nightmare really fast.

The SUMIFS function would work, but the extra criteria only seems to be connected with AND() and since a bike can't be a Huffy AND a Panasonic, it always brings back Zero. Is there a way to use a SUMIFS() that connects conditions with OR()?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Do you have the category listed for each item as well?
 
Upvote 0
No, sorry, I didn't make that very clear. That is what I am trying to do. There aren't categories in the data, so I need to sum all brand names for each category. For example:

Bikes: Huffy, Panasonic, MountainKing, etc.
Candy: Reese's, Nestle, M&M

So I am labeling the formula on my Summary sheet, "Bikes" then using a chain of SUMIF() to add each of the bike brands to get that summary. It works, but it's very complicated with this much data, so I was hoping there was a way to do

=SUMIF(Brand,"Huffy" OR "Panasonic" or "Mountainking",Units Sold) or something that would at least function similarly.
 
Upvote 0
You can shorten your formula like this

=SUM(SUMIF(Sales!A:A,{"Huffy","Panasonic","RideKing"},Sales!B:B))

or if you have a list for each category, as Norie suggests, then you can use that, e.g. list all the possible brands for a specific product in Z1:Z10 and use

=SUMPRODUCT(SUMIF(Sales!A:A,$Z$1:$Z$10,Sales!B:B))
 
Upvote 0
I have a worksheet with two Sheets: 1 sheet for my report, and another with my Sales database. The database has brand names of products in column A and number of units sold in column B. I need to sum items by category by adding up all the sales of each brand name.

My Units Sold Formula on my report is several SUMIF() functions strung together:

Example: =SUMIF(Sales!A:A,"Huffy",Sales!B:B)+SUMIF(Sales!A:A,"Panasonic",Sales!B:B)+SUMIF(Sales!A:A,"RideKing",Sales!B:B)

Since some of the products have 25 or 30 brand names, these formulas become a nightmare really fast.

The SUMIFS function would work, but the extra criteria only seems to be connected with AND() and since a bike can't be a Huffy AND a Panasonic, it always brings back Zero. Is there a way to use a SUMIFS() that connects conditions with OR()?

Try...

=SUM(SUMIF(Sales!A:A,{"Huffy","Panasonic","RideKing"},Sales!B:B))

If you create a range housing the criteria set, name list, invoke:

=SUMPRODUCT(SUMIF(Sales!A:A,List,Sales!B:B))
 
Upvote 0
I have no idea how the SUMPRODUCT function worked, but it does and that is fantastic. Thanks so much guys! You have literally just saved me dozens of hours!
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,922
Latest member
nstaab07

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
Back
Top