by Svetlana Cheusheva, updated on

*Do you know how to sum numbers in a certain column when a value in another column meets any of the specified conditions? In this article, you will learn 3 different ways to do SUMIF using multiple criteria and OR logic.*

Microsoft Excel has a special function to sum cells with multiple conditions - the SUMIFS function. This function is designed to work with AND logic - a cell is added only when all of the specified criteria are TRUE for that cell. In some situations, however, you may need to sum with multiple OR criteria, i.e. to add a cell when any of the conditions is TRUE. And this is when the SUMIF function comes in handy.

When you are looking to sum numbers in one column when another column is equal to either A or B, the most obvious solution is to handle each condition individually, and then add the results together:

SUMIF(range, *criteria1*, sum_range) + SUMIF(range, *criteria2*, sum_range)

In the table below, suppose you want to add up sales for two different products, say *Apples* and *Lemons*. For this, you can supply the items of interest directly in the *criteria* arguments of 2 different SUMIF functions:

`=SUMIF(A2:A10, "apples", B2:B10) + SUMIF(A2:A10, "lemons", B2:B10)`

Or you can enter the criteria in separate cells, and refer to those cells:

`=SUMIF(A2:A10, E1, B2:B10) + SUMIF(A2:A10, E2, B2:B10)`

Where A2:A10 is the list of items (*range*), B2:B10 are the numbers to sum (*sum_rage*), E1 and E2 are the target items (*criteria*):

**How this formula works:**

The first SUMIF function adds up the *Apples* sales, the second SUMIF sums the *Lemons* sales. The addition operation adds the sub-totals together and outputs the total.

The SUMIF + SUMIF approach works fine for 2 conditions. If you need to sum with 3 or more criteria, the formula will become too big and difficult to read. To achieve the same result with a more compact formula, supply your criteria in an array constant:

SUM(SUMIF(range, {*crireria1*, *crireria2*, *crireria3*, …}, sum_range))

Please remember that this formula works based on OR logic - a cell is summed when any single condition is met.

In our case, to sum sales for 3 different items, the formula is:

`=SUM(SUMIF(A2:A10, {"Apples","Lemons","Oranges"}, B2:B10))`

In the above screenshot, the conditions are hardcoded in an array, meaning you will have to update the formula with every change in the criteria. To avoid this, you can input the criteria in predefined cells and supply to a formula as a range reference (E1:E3 in this example).

`=SUM(SUMIF(A2:A10, E1:E3, B2:B10))`

In Excel 365 that supports dynamic arrays, it works as a regular formula completed with the Enter key. In pre-dynamic versions of Excel 2019, Excel 2016, Excel 2013 and earlier, it should be entered as an array formula with the Ctrl + Shift + Enter shortcut:

**How this formula works:**

An array constant plugged into SUMIF's criteria forces it to return multiple results in the form of an array. In our case, it's 3 different amounts: for *Apples*, *Lemons* and *Oranges*:

`{425;425;565}`

To get the total, we use the SUM function and wrap it around the SUMIF formula.

Don't like arrays and are looking for a normal formula that would allow you to sum with multiple criteria in different cells? No problem. Instead of SUM, use the SUMPRODUCT function that handles arrays natively:

SUMPRODUCT(SUMIF(range, *crireria_range*, sum_range))

Assuming the conditions are in cells E1, E2 and E3, the formula takes this shape:

`=SUMPRODUCT(SUMIF(A2:A10, E1:E3, B2:B10))`

**How this formula works:**

Like in the previous example, the SUMIF function returns an array of numbers, representing the sums for each individual condition. SUMPRODUCT adds these numbers together and outputs a final total. Unlike the SUM function, SUMPRODUCT is designed to process arrays, so it works as a regular formula without you having to press Ctrl + Shift + Enter.

Since the Excel SUMIF function supports wildcards, you can include them in multiple criteria if needed.

For example, to sum sales for all sorts of *Apples* and *Bananas*, the formula is:

`=SUM(SUMIF(A2:A10, {"*Apples","*Bananas"}, B2:B10))`

If your conditions are supposed to be input in individual cells, you can type wildcards directly in those cells and provide a range reference as criteria for the SUMPRODUCT SUMIF formula:

In this example, we put a wildcard character (*) before the item names to match any preceding sequence of characters such as *Green apples* and *Goldfinger bananas*. To get a total for items that contain specific text anywhere in a cell, place an asterisk on both sides, e.g. "*apple*".

That's how to use SUMIF in Excel with multiple conditions. I thank you for reading and hope to see you on our blog next week!

SUMIF multiple criteria (.xlsx file)

Table of contents