The SUMIF function of Google Sheets is also known as the “Sum if” function. It is used to sum the given information by following some conditions. For example, a number of employees work in the office and some of them earn performance bonuses more than once time in a year. To calculate the amount of the bonus of earn by the specific employee, the sumif function of Google Sheets can be used.
This blog is helpful in understanding the usage of the SUMIF function in Google Sheets with the help of the example.
What is the General Syntax of Using the SUMIF Formula in Google Sheets?
The general syntax of using the SUMIF formula in Google Sheets is as shown below:
SUMIF(range, condition, sum_range)
The explanation of the above formula is:
- Use the SUMIF formula
- First, define the range of the cells on which the condition is to be applied
- Then define the condition, for example, the employee name whose bonuses are supposed to be calculated
- Lastly, define the range of the cells from which the information is supposed to be added
The above general syntax of using the SUMIF function in Google Sheets is demonstrated with the help of the example.
Example 1: We have a Google Sheet with the name “Grocery Details” in which different items are mentioned as groceries. These grocery items are purchased on different dates in various amounts:
We will calculate the total amount of “Sugar” purchased on the mentioned dates by entering the formula in the below-empty cell:
SUMIF(B2:B7, “Sugar”, C2:C7)
The total amount of the “Sugar purchased” in the mentioned dates have been calculated:
The total amount of the “Sugar” purchased is $7.
Example 2: Similarly to the above example, we can also apply the “number” condition instead of the “Text Condition”. For example, we will calculate the amount which is equal to and greater than “6” by adding them all. This can be done by using the “SUMIF” function of Google Sheets, and applying the formula:
SUMIF(C2:C7, “>6”)
The number greater than 6 is 7 and 10 whose sum is shown in the cell:
Example 3: In the above two examples, we have calculated the sum by applying the text-based and number-based conditions. Now in this example, we will apply the “Date-based” condition. For example, we will sum the total amount of products purchased before “4-1-2023” by using the SUMIF formula:
=SUMIF(A2:A7,"<"&DATE(2023,1,4),C2:C7)
The amount is equal to $26 which has been displayed:
Conclusion
To use the SUMIF function of Google Sheets, follow the general syntax “=SUMIF(range, conditions, sum range)” and it is used to calculate the sum of the specified column on some condition. This blog demonstrates the text-type, number-type, and date-type usage of the SUMIF on Google Sheets.