The SUMIF function in Google Sheets is a powerful tool that allows users to calculate the sum of a range based on specific conditions. It is especially useful for data analysis and financial reporting, enabling users to quickly obtain aggregate values that meet particular criteria.
Syntax
SUMIF(range, criterion, [sum_range])
- range: The range of cells that you want to evaluate against the criterion.
- criterion: The condition that determines which cells in the range will be summed. This can be a number, expression, or text.
- sum_range: (Optional) The actual cells to sum. If omitted, the function sums the cells in the range parameter.
Example #1
SUMIF(A2:A10, ">50")
This function sums all the values in the range from A2 to A10 that are greater than 50. For example, if A2:A10 contains values {30, 70, 55, 45, 80}, the result would be 150, as it includes 70, 55, and 80.
Example #2
SUMIF(B2:B10, "=Yes", C2:C10)
This function sums the values in C2:C10 where the corresponding cells in B2:B10 equal “Yes”. If B2:B10 has values {Yes, No, Yes, No, Yes} and C2:C10 has {100, 200, 150, 50, 300}, the result would be 550 (100 + 150 + 300).
Example #3
SUMIF(D2:D10, "<100", D2:D10)
This function sums the cells in D2:D10 that are less than 100. If D2:D10 contains values {150, 90, 80, 120}, the result would be 170 (90 + 80).
Error handling
- VALUE! – Indicates that one of the parameters is of the wrong type, such as a non-numeric criterion.
- N/A – Occurs if the criterion does not match any data within the specified range.
- REF! – Means the function is referencing a cell or a range that is not valid, possibly due to deleted or invalid ranges.