Excel Productivity Guide
Useful Excel Tips | Keyboard Shortcuts | VBA Codes
Download this Free E-Book to take your excel skills to a whole next level using some smart Excel tactics.
Worth $20, Absolutely Free
Sometimes we need to make small amendments in formulas to make them more flexible and effective.
Just like that, SUMIF OR is an advanced formula which helps you to increase the flexibility of SUMIF. Yes, you can also do SUMIFS OR.
Let's understand this first.
In SUMIFS, you can use more than one criteria to get a sum and in SUMIF you can only use one criterion.
Let's say, in SUMIFS, if you specify two different criteria, it will sum only those cells which meet both of the criteria.
Because it works with AND logic, so all the criteria should meet to get a cell included.
And, sometimes it’s a limitation.
Let me show an example where we need to add an OR logic in SUMIFS or SUMIF.
Take a look at below data table where you have a list of products with their quantity and current status about the shipment.
In this data, you have two types of products (Faulty and Damaged) which you need to return to our vendor.
But before that, you want to calculate the total quantity of both types of products.
If you go with the normal method, you have to apply SUMIF twice to get this total.
But if you use an OR condition in SUMIF/SUMIFS then you can get a total of both of the products with just one formula.
Before we start, please download this sample file from here to follow along.
In any other cell in your worksheet where you want to calculate the total, insert below formula and hit enter.
In above formula, you have used SUMIFS but if you want to use SUMIF you can insert below formula in the cell.
By using both of above formulas you will get 540 in the result. To cross verify, just check the total manually.
Related: COUNTIF OR
As I said, SUMIFS function use AND logic to sum values. But, the formula which you have used above include an OR logic in it.
To understand this formula you have to split it in three different parts.
With above concept, you are able to get a total for both types of product in a single cell. It will work same with SUMIF and SUMIFS.
And, you can also further expand your formula by specifying product name in second criteria in SUMIFS to get the total for a single product.
Download this sample file from here to learn more.
In the comment section, @Shay asked me about using a cell reference to add multiple criteria instead inserting them directly into the formula.
Well, that's a super valid question and you can do this by using dynamic named range instead of hardcore values.
And for this, you need to do just two little amendments in your formula.
So, now your formula will be:
Let me take you to next level of this formula. Just look at the below data table.
In this table, you have two different columns with two different kind of status.
Now, from this data table you need to sum quantity where the product is damage return status is "No".
That means, only those Damage and Faulty products which are not returned yet. And, formula for this will be.
Download this final sample file from here to learn more.
The best part about using OR technique is you can add as many as criteria in it.
If you want to use only OR logic then it’s fine to use SUMIF. And if you want to create an OR condition and AND condition in a single formula then you can use SUMIFS for that.
You know, this is one of my favorite formula tips and I hope you found it useful.
Now tell me one thing. Have you ever used this kind of formula before? Please share with me in the comment section, I'd love to hear from you.
And, please don't forget to share this tip with your friends.