How to use SUMIF in Excel with multiple conditions (OR logic)

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.

SUMIF + SUMIF to sum cells equal to this or that

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):
Excel SUMIF formula with multiple 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.

SUMIF with array constant - compact formula with multiple criteria

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))

SUMIF formula with array constant to sum cells with multiple OR criteria

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:
SUM and SUMIF formula with multiple criteria in different cells

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:


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

SUMPRODUCT and SUMIF to sum cells with multiple OR conditions

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 and SUMIF to sum cells with multiple OR conditions

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.

SUMIF using multiple criteria with wildcards

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:
SUMIF using multiple criteria with wildcards

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!

Practice workbook for download

SUMIF multiple criteria (.xlsx file)

You may also be interested in

Category: Excel Tips

Table of contents

26 responses to "How to use SUMIF in Excel with multiple conditions (OR logic)"

  1. E.S says:


    Thank you for the details and steps above!

    I am having some issues with the Sum+sumif and sumproduct formulas, when I enter in the formula with the range E1:E3 I get a '0' value returned. I went back to the steps again and continuously checked the formula, but still get the '0' value.

    What other areas/values should I check?

    Thank you,


    • Hi!

      It's difficult to say anything certain without seeing your data and formula. For starters, please check if the numbers you are summing are really numbers and not numbers stored as text. If you add them up with a simple formula like =A1+A2+A3..., does it work? If this simple calculation works fine, then the problem is definitely with the Sum+Sumif formula.

      You can send your source data and expected result to us at, and we will try to figure it out.

    • Hello!
      The information you provided is not enough to understand your case and give you any advice, sorry. For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result.
      It’ll help me understand it better and find a solution for you.

  2. UNNI says:



  3. Abubakar uzairu says:

    Thanks for good guidance

  4. ian marsden says:


    I have the following formula


    This give the desired output for fred and Saturday but I need to add the same again but for fred and Sunday, which would also change the refernce M2 to R2. So the equiv' formula for fred and Sunday is


    How do I combine the two?



    • Hello!
      Add a condition to test the value of cell L12

      =IF(ISNUMBER(SEARCH(“saturday”,L12)), IF(ISNUMBER(SEARCH(“fred”,B12))*ISNUMBER(SEARCH(“saturday”,L12)),E12*$M$2*$R$5,””), IF(ISNUMBER(SEARCH(“fred”,B12))*ISNUMBER(SEARCH(“sunday”,L12)),E12*$R$2*$R$5,””))

      I hope it’ll be helpful.

  5. Phani says:

    Dear Sir,

    RID NAME Jan 01 Jan 02 Jan 03 Jan 04 Jan 05 Jan 06 Jan 07 Jan 08 upto Dec 31
    10001 Name 1 # # # # P A A A P P
    10002 Name 2 # # # # P A A A P P
    10003 Name 3 # # # # P A A A P P
    10004 Name 4 # # # # P A A A P P
    10005 Name 5 # # # # P A A A H H
    10006 Name 6 # # # # P A A A P P

    H Half day
    A absent
    P present

    RID MONTH No of Days Present
    10001 JANUARY ?

    How to get no of days present with given parameters.

    Thanks - D. Phani Kumar

  6. kamal kant says:

    i am trying to set formulae for calculating figures in various sheets for dated 1st to 30th of month in which all the figures are in same column i,e for example A5 of sheet 1,sheet 2.

    please suggest me the formulae

  7. Kirk says:

    I would like to request your assistance in developing an Excel formula.

    I would like to count only the first occurrence in which an ID number appears in a column and also the text "received" appears in the same record (row) for that ID.

    For example, if ID 5596326 occurs 6 times and "received" occurs 2 times for that ID.

    For this ID, the answer would be 1.

    What would be the formula?

    This has really stumped me, and I would appreciate your help.

    • Hello!
      If I understand your task correctly, the following formula should work for you:


      I hope this will help, otherwise please do not hesitate to contact me anytime.

      • Kirk says:

        If the data, with a header row, consists of 100 records, with an ID column and a results column, how is the range or ranges specified?

        • Hi,
          If I got you right, the formula below will help you with your task:


          After that you can copy this formula down along the column.

          • Kirk says:

            This formula =IF(COUNTIFS($A$2:$A$101,A2,$B$2:$B$101,”received”)>0,1,””) does not answer the question that I am asking. This formula results in a count of 1 on a single row for an ID in one colum and when "received" appears in an other column.

            But my question is different. Take this example in which the ID is identical, but "received" appears twice. The same ID might appear 10 times and "received" 4 times. The problem is the same.

            How for a single ID that may appear many times can a formula be written to produce one distinct result of 1 for an ID when the ID and "received" may appear more than once?

            So the result that I am looking for is not 1 per row in which "received" appears, but 1 per distinct ID when the ID and "received" may appear multiple times as in the example.

            5596326 attempted
            5596326 delivered
            5596326 received
            5596326 received
            5596326 sent
            5596326 Wrong Number

            • Kirk says:

              The result that I am looking for can be achieved by filtering the workbook on "received," copying the filtered result to another worksheet, and remove duplicate rows by ID. Then I would just look at the resulting number of rows in teh worksheet and that would be the total number of distinct cases for a single ID and "received" having occurred at least once.

              But I am looking for a formula to do that instead of going through the filtering and unduplicating procedure.

            • Hello!
              Sorry, I do not fully understand the task. Write an example of the result you want to get. You sent a file with an example of source data, but there is no example of the expected result. Do you want to get a list of IDs? I cannot guess.

  8. Kirk says:

    The source data are below and the expected result is 1.

    For the data below in two column, the formula result should be 1 eventhogh the ID5596326 appears 6 times and "received" 2 times.

    5596326 attempted
    5596326 delivered
    5596326 received
    5596326 received
    5596326 sent
    5596326 Wrong Number

  9. Kirk says:

    "Count the number of unique IDs for which "received" is written." Exactly. Now you have undestood. Thank you.

  10. Peter Gay says:

    Thanks for your helpful articles. Very clear and well presented. I am trying to use the SUMIF formula to extract a total value from 1 column using a qualifying value detailed in another column between defined limits eg 1.60 to 2.0. I tried using "2.0" which gives an error message. I then tried SUMIFS but this appears to need values in 2 different columns to work. Is there a further article that would help here please? You can see the spreadsheet on this link if it helps. The cell in question is D6 and E5 will need a similar solution ( I have used a simple work around for the time being but this will only work if I do not want to add further analysis). Thanks and regards Peter

Post a comment

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)