How to Use SUMIF Function in Excel (With 5 Easy Examples)

Overview of SUMIF function

In terms of calculating the summation of some numbers sometimes we may need to apply conditions or criteria. MS Excel helps us with these kinds of problems by providing another powerful function named SUMIF. This article will share the complete idea of how the SUMIF function works in Excel autonomously and then with other Excel functions.

Read More: How to Use SUMIFS Function in Excel (6 Handy Examples)

Download the Practice WorkBook

SUMIF Function in Excel (Quick View)

Overview of SUMIF function

Excel SUMIF Function: Syntax & Arguments

Excel SUMIF Function Syntax & Arguments

Summary

Adds the cells specified by a given condition or criteria.

Syntax

=SUMIF (range, criteria, [sum_range])

Arguments

Argument Required or Optional Value
range Required The range of cells that we want to be evaluated by criteria.
criteria Required The criteria are in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added.
[sum_range] Optional The actual cells to add if we need to combine cells other than those defined in the range argument.

Note: 

  • In criteria, wildcard characters can be included – a question mark (?) to match any single character, an asterisk (*) to match any sequence of characters. Like 6?”, “apple*”, “*~?”
    • Here question mark (?) will be used for matching any single character.
    • An asterisk (*) will be used to match any sequence of characters. Using this method, we can find out any text or string by matching any substring. Like “*Apples” we can find the words like Pineapples or any other words where the last portion is “Apples”.
  • sum_range should be the same size and shape as the range.
  • SUMIF function only supports a single condition.

How to Use the SUMIF Function in Excel (N Examples)

Example 1: Calculate Sum with Numeric Criteria Using SUMIF Function

Using the SUM function, we can calculate the sum with the numeric conditions. For showing the process let’s assume we have a dataset of some Foods with their name, category, date, and sales. Now we will count the total sales where every price was more than $1000.

Calculate Sum with Numeric Criteria Using SUMIF Function

Step 1: Enter the formula in cell H7 and press Enter

=SUMIF(E4:E19,">1000")

Formula Explanation

  • In this formula, E4:E19 is the range where the sum operation will be performed.
  • “>1000” is the criteria. So, if the sales value is more than $1000 then it will be counted otherwise it will be ignored.

Enter formula using SUMIF function

Example 2: Calculate Sum with Text Criteria Using SUMIF Function

Now let’s see how to calculate sum using text criteria. Here our concern is to calculate sales from the dataset where the Category will be Fruits.

Calculate Sum with Text Criteria Using SUMIF Function

Step 1:  Enter the formula in cell H7 and press Enter

=SUMIF(C4:C19,"Fruits",E4:E19)

Formula Explanation

  • Here C4:C19 is the range where we will check our criteria.
  • “Fruits” is the condition or criteria. We are checking if the Category is Fruits or not.
  • Lastly, E4:E19 is the sum range where we will perform the sum operation of the selected rows.

Enter formula using SUMIF function for text condition

SUM Function with Wildcard Characters

In the criteria argument, we can also utilize wildcard characters in the SUM function. Let’s assume we want to calculate the sum of the total sales of those foods named Apples.

Sum function with wildcard characters

Step 1: Enter the formula in cell H7 and press Enter

=SUMIF(B4:B19,"*Apples",E4:E19)

Formula Explanation

  • “*Apples” will find out the data where the Food name will be Apples or the first or last part of the food name is apples.

Sum function formula with wildcard characters

Example 3: Calculate Sum with Date Criteria Using SUMIF Function

The SUM function is also applicable for using data conditions. Let’s say that we want to get the sum of sales of those foods where the date is after 04/01/2021.

Calculate Sum with Date Criteria Using SUMIF Function

Step 1: Enter the formula in cell H7 and press Enter

=SUMIF(D4:D19,">"&DATE(2021,4,1),E4:E19)

Formula Explanation

  • “>”&DATE(2021,4,1) this portion is our criteria. Firstly, “>” is used to find the greater dates. Then ampersand (&) is used to concatenate the formula and text. DATE function is used to give date input.
  • The DATE function in Excel accepts three arguments: year, month, and day. If you want to know more about this function you can check this Link

Enter formula using SUM and DATE function

Example 4: Calculate Sum with OR Criteria Using SUMIF Function

Or logic means if any logic or condition is true from the given logic then it will return true. We can use this logic using the SUM function. Let’s assume we want to calculate the total sales where Category is Vegetables, or each sale is greater than $1000.

Calculate Sum with Or Criteria Using SUMIF Function

Step 1: Enter the formula in cell H7 and press Enter

=SUMIF(C4:C19,"Vegetables",E4:E19)+SUMIF(E4:E19,">1000",E4:E19)

Formula Explanation:

  • SUMIF(C4:C19, “Vegetables”, E4:E19) this part will find the rows where Category is equal to Vegetables.
  • Plus sign (+) is used for the OR operation.
  • SUMIF(E4:E19,”>1000″, E4:E19) this part will find the rows where Sales are greater than $1000.

Or operation using SUMIF function

Example 5: SUMIF with an Array Argument

In the SUMIF function, we use the array argument as a condition. Array argument is nothing but an array of some elements in any function’s parameter. Like: {“A”, “B”, “C”} etc. Now here we will count the total sales where Category is Fruits and Dairy using SUMIF function.

SUMIF with an Array Argument

Step 1: Enter the formula in cell H7 and press Enter

=SUM(SUMIF(C4:C19,{"Fruits","Dairy"},E4:E19))

Formula Explanation

  • SUMIF(C4:C19,{“Fruits”, “Dairy”}, E4:E19) this part will find the total sales individually for Fruits and Dairy. Like $20400.00 for Fruits and $9100.00 for Dairy.
  • Then SUM function will return the total of these two categories.

 Formula using SUMIF and SUM function

Things to Remember

Common Errors When they show
#VALUE! The SUMIF function returns incorrect results when you use it to match strings longer than 255 characters or to the string.

Conclusion

This is all about the SUMIF function and its different applications. Overall, in terms of working with time, we need this function for various purposes. I have shown multiple methods with their respective examples but there can be many other iterations depending on numerous situations. If you have any other method of utilizing this function, then please feel free to share it with us.


Further Readings

Md. Abdullah Al Murad

Hello! Welcome to my Profile. Currently, I am working and researching Microsoft Excel, and here I will be posting articles related to this. My last educational degree is BSc, and my program was Computer Science and Engineering from American International University-Bangladesh. I am a Computer Science graduate with a great interest in research and development. Always try to gather knowledge from various sources and try to make innovative solutions.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo