This tutorial explains the basics of SUMIF and SUMIFS functions in LibreOffice Calc.
Table of Contents
SUMIF Function returns the sum total of the values from a range/list of cells based on a condition. For example, if you have a list of numbers in Calc and want to sum only the values which are less than 20, then you can use SUMIF function.
Here are some examples which help you to understand the workings of SUMIF.
The below example sums the values from cells A1 to A6 if it is less than 20. The yellow highlighted values are the cells which are matching with the conditions.
You can also keep the criteria value, i.e. 20 in a cell and use the cell reference in the SUMIF formula as below. It gives the same result as above.
SUMIF can take three arguments where based on the criteria, match in a range, you can sum another range. Below example, searches 10 in A1 to A6 and returns corresponding sums from range B1 to B6 if a match is found.
Similarly, you can put a value of 10 in any cell and use the cell reference in the above formula.
You can also search texts as well similar way and return the sum.
The following example searches “apple” in the range A1:A6 and returns the sum of matching entries from the corresponding sum range.
Using the below condition, you can sum the values that are NOT equal to a specific text/string. The NOT operator is
<>. Please note that <> operator is inside the text with
To search using a single wild card character, you can use ? in the condition. E.g. if you want to sum only strings matching with “apple4” and not “apple10” or “apple”, use the below example.
You can also use wild card * to search any number of characters in a range of cells and return the sum using SUMIF. The below example sums all matching cells where the apple word is found.
You can use
SUMIFS for multiple criteria ranges for summing up values. SUMIFS takes the first argument as the range to be summed and next the set of criteria as per the above examples.
In the below example, it returns the sum of revenue when sales are less than or equal to 20, and the product name starts with
- SUMIFS conditions are evaluated as AND, and the sum is returned only when all conditions are satisfied.
- SUMIFS conditions ranges should be of the same length.
- You can specify at most 127 conditions pairs in SUMIFS.
This guide definitely would help you understand the working principles of SUMIF and SUMIFS. You can experiment with more conditions as per your need in LibreOffice Calc. Drop a comment below if you have any questions.