Mastering data analysis with the SUMIF function in Google Sheets! This essential tool allows you to add up values that meet specific criteria, making it perfect for tracking expenses, analyzing sales data, and more. With SUMIF in Google Sheets, you can effortlessly sum values based on conditions you set, streamlining your data management tasks.
SUMIF in Google Sheets
Syntax and Basic Uses of SUMIF in Google Sheets
Understand the basic syntax and uses of the SUMIF function in Google Sheets to get started with this powerful tool.
=SUMIF(range, criterion, sum_range)
range: Range of cells where the condition has to be checked.
criterion: The condition that has to be matched with the cells specified in the range above.
sum_range(optional): The range of cells with numerical data that has to be summed up. If this is not specified, then the first range is checked for condition and summed up.
SUMIF is useful in managing financial records or databases, tracking sales performance and much more.
Explore various examples of SUMIF formulas to understand how to use this function in different scenarios.
1. SUMIF Formulas with Text Criteria
Let us consider the following data. Table 1 "Book-wise Data" has a list of books along with their genre and no. of available copies.
Sample Data of a Library where there are books belonging to different genres.(i) SUMIF equal to (exact match):
=SUMIF(C3:C18,"Adventure",D3:D18)
Equal toExplanation: Finds "Adventure" in the range C3:C18 and sums their corresponding values found in range D3:D18. Hence it will give us the total number of books of the adventure genre.
Note: The condition should always be written within double quotes("") and it is not case sensitive-"Adventure" and "adventure" are considered the same.
(ii) SUMIF not equal to (Exact match)
=SUMIF(C3:C18,"<>Adventure",D3:D18)
Not equal toExplanation: The formula returns the sum of all those books whose genre is NOT "adventure".
The following formulas are useful to match the text partially with the cell contents.
(i) SUMIF cell contains (Partial Match)
=SUMIF(B3:B18, "*abridged*", D3:D18)
Cell contains
Explanation: This gives us the number of books which are abridged. It looks for the word "abridged" in the cell range B3:B18 and sums corresponding values found in range D3:D18.
(ii) SUMIF cell does not contain (Partial match)
=SUMIF(B3:B18, "<>*abridged*", D3:D18)
Cell does not contain
Explanation: Whichever cell in range B3:B18 does not contain the text "abridged", its corresponding number of copies is summed up to give the result.
(iii) Case-sensitive SUMIF in Google Sheets
As already mentioned above, the SUMIF function is case-insensitive, to differentiate between uppercase and lowercase text, the following syntax can be used.
=SUMIF(ArrayFormula(EXACT(criterion, range)), TRUE, sum_range)
or
=SUMIF(ArrayFormula(FIND(criterion, range)), 1, sum_range)
In our case, if we want to find books that belong to genre "Adventure" only and not "adventure", the formula would look like:
Finding only "Adventure" and not "adventure"
=SUMIF(ArrayFormula(EXACT(criterion, range)), TRUE, sum_range)
ArrayFormula makes EXACT comparisons to the criterion provided with the values in range. If an Exact Match is found, the formula returns True, otherwise False.
Out of the True and False values in the range, SUMIF searches for True values and sums up corresponding values in Sum_range.
Similarly, if we use the FIND function separately, it will stop searching as soon as it finds the first match. Wherever the match is found, it returns a 1 and #VALUE! error for cells where the value is not found.
=SUMIF(ArrayFormula(FIND(criterion, range)), 1, sum_range)
The criterion need not always be text. Let's say we want to find the number of books whose number of copies is more than 50. In such cases the following formulas can be used.
(i) SUMIF greater than or less than
To find the number of books whose number of copies is more than 50,
=SUMIF(C22:C26, ">50")
SUMIF greater than or less than
Here the sum_range has been eliminated since the range and sum_range both were the same in this case. In cases where they are different, sum_range needs to be specified.
=SUMIF(D3:D18, "<50",D3:D18)
This can also be done using cell referencing using the "&"(ampersand) . If the value in cell D21 is 50 then we can use:
=SUMIF(C22:C26, ">"&D21)
SUMIF greater than or less thanFor other comparison criteria, the following logical operators can be used.
Greater than | > |
---|
Greater than or equal to | >= |
---|
Less than | < |
---|
Less than or equal to | <= |
---|
(ii) SUMIF equal to
To find the number of books whose number of copies is equal to 50,\
=SUMIF(C22:C26, 50)
SUMIF equal toor
=SUMIF(C22:C26, "=50")
SUMIF equal to
or (using cell referencing, if cell D21 has value 50)
=SUMIF(C22:C26, D21)
SUMIF equal to
Note: If the value is directly being specified, then it should be written without quotation marks, otherwise if it is being used with "=" sign, then quotation marks should be used.
Again, if the sum_range is not the same as range then it needs to be specified separately.
(iii) Sum if not equal to
This is similar to the not equal to criterion in text. To find the total number of books whose number of copies is not equal to 50, we can use the formula:
=SUMIF(C22:C26, "<>50",C22:C26)
or (using cell referencing, if cell E2 has value 50)
=SUMIF(C22:C26, "<>"&D21,C22:C26)
Sum if not equal to
Google sheets can sum up values based on dates but a specific format for comparing the dates is to be followed. If I want to sum values of books bought before a date of format DD/MM/YYYY, then we can use one of the following:
=SUMIF(range, "<MM/DD/YYYY", sum_range)
or
=SUMIF(range, "<"&DATE(YYYY,MM,DD), sum_range)
or if the date is written in the cell E22 in the format MM/DD/YYYY, then
=SUMIF(range, "<"&E22, sum_range)
Google Sheets SUMIF formulas for dates
Similarly, other logical operators given in the table earlier in this article can be used for other comparisons.
To sum cells based on TODAY's date, TODAY() function can be included.
For example, to check number of books bought today (today is 30 May 2024),
=SUMIF(C22:C26, TODAY(), D22:B26)
Google Sheets SUMIF formulas for dates
6. Sum based on blank or non-blank cells
To sum values whose value in a certain column is blank or not blank we may use the following in criterion:
"=" (SUMIF Blank) | completely blank cells |
---|
""(SUMIF Blank) | cells including those that contain zero length strings |
---|
"<>"(SUMIF Not blank) | cells with any value, including zero length strings |
---|
(i) SUMIF Blank
To find the total number of books whose date of purchase is not mentioned:
=SUMIF(C22:C26,"", D22:D26)
SUMIF Blank
(ii) SUMIF Not blank
To find the total number of books whose date of purchase is mentioned(not blank):
=SUMIF(C22:C26,"<>", D22:D26)
SUMIF Not blank
7. Google Sheets SUMIF with multiple criteria (OR logic)
Google sheets lets us sum values based on multiple criteria. Let's say we want to find the total number of books belonging to genre "Horror" or "Thriller", we can apply the multiple criteria formula:
=SUMIF(C3:C18,"Horror",D3:D18)+SUMIF(C3:C18,"Thriller",D3:D18)
Google Sheets SUMIF with multiple criteria (OR logic)This formula works even if any one of the criteria is fulfilled (OR Logic).
Google Sheets SUMIF - Things to Remember
Now that we know a lot about the usage of SUMIF in google sheets, let us not forget to keep these points in mind while using this function:
1. SUMIF can evaluate only one condition
The SUMIF syntax allows only using one range, one criterion and one sum_range. To apply multiple criteria, two formulas can be added (as shown above)
2. The SUMIF function is case-insensitive
If we put "Adventure" in the exact match criterion, then it considers both "adventure" and "Adventure" as same and sums up corresponding values for both.
3. Supply equally sized range and sum_range
Only equal sized ranges can be used. If the range is C3:C18 then sum_range must be D3:D18 and not D3:D20.
4. Mind the syntax of SUMIF criteria
If the criterion is text, wildcard character or logical operator (followed by a number, text or date) it must be enclosed in quotation marks.
=SUMIF(C3:C18,"Horror",D3:D18) =SUMIF(C3:C18,"*",D3:D18) =SUMIF(D3:D18,">50") =SUMIF(C3:C18,"<>Horror",D3:D18)
Otherwise, if it contains a logical operator and a cell reference or another function then the cell reference or function should not be enclosed in quotes.
=SUMIF(D3:D18,">"&E2) =SUMIF(D3:D18,">"&TODAY())
5. Lock ranges with absolute cell references if needed
In cases where we autofill the cells with SUMIF formula or copy-paste the formula somewhere else and we do not want the cell addresses to change then we must lock them using $ symbol.
=SUMIF($C$3:$C$18,"<>Horror",$D$3:$D$18)
Conclusion
To leverage the full potential of a dataset, mastering the advanced functions provided by spreadsheets is one way. SUMIF provides an efficient method to isolate and add relevant data without disturbing the other values. This function not only saves one's time but also improves the precision of the decision making process.
Similar Reads
Google Sheets: Creating Simple Formulas Google Sheets is a powerful spreadsheet tool that allows you to create and edit sheets with ease. It also boasts real-time collaboration features, making it perfect for teamwork. But where Sheets truly shines is in its formula capabilities. Formulas can automate calculations, saving you time and eff
6 min read
Top Google Sheets Formulas Google Sheets is a versatile, cloud-based spreadsheet tool that allows users to create, edit, and share data online. Whether you're managing a business, organizing school work, or performing data analysis, learning Google Sheets formulas can significantly enhance your productivity. With the right fo
8 min read
How to Create a Google Form in Google Sheets Creating a Google Form directly from Google Sheets is a powerful way to collect data and responses efficiently. This integration makes it simple to gather information, whether you're conducting surveys, quizzes, or gathering feedback for a project. By linking a Google Form to a Google Sheet, all res
7 min read
Excel SUMIF Function: Formula, How to Use and Examples The SUMIF function in Excel is a versatile tool that enables you to sum values based on specific criteria, such as a true or false condition. This feature makes it perfect for conditional summation tasks like totaling sales over a particular amount, adding up expenses in specific categories, or summ
7 min read
How to Copy a Formula Down an Entire Column in Google Sheets Imagine having a superpower that can enhance your productivity in Google Sheets. Well, copying formulas down an entire column in the one. Instead of doing the same calculations again and again, you can easily do your tasks by using this method. It's like having a clone army of formulas at your comma
5 min read
Sum in Math | Definition, Examples & Formulas In mathematics, the term "sum" refers to the result obtained by adding two or more numbers or quantities together. It's a fundamental arithmetic operation used to find the total of multiple values. For example, when you add 5 and 7, the sum is 12.In this article, we will learn the concept of Sum in
8 min read