The SUMIF function is a premade function in Google Sheets, which calculates the sum of values in a range based on a true or false condition. Show - Example SUMIF function
- Google Sheets SUM to total values
- Google Sheets SUM syntax to total values
- Google Sheets SUM basic formula example
- Google Sheets SUM to total a cell range
- Google Sheets SUM syntax to total cells
- Google Sheets SUM formula example for scattered cells
- Google Sheets SUM formula example for an integral cell range
- Google Sheets SUM to total values and cells
- Google Sheets SUM function syntax to total values and cells
- Google Sheets SUM formula example to total values and cells
- How to SUM a column in Google Sheets
- SUM a limited range from a column in Google Sheets
- SUM an entire column in Google Sheets
- How to SUM a row in Google Sheets
- How to return SUM of multiple rows in one column in Google Sheets
- Workaround#1: Sum multiple rows with ARRAYFORMULA in Google Sheets
- Workaround#2: Sum multiple rows with ARRAYFORMULA, MMULT, TRANSPOSE, and COLUMN in Google Sheets
- How to return SUM of multiple columns in one row in Google Sheets
- Google Sheets SUMIF to sum a data range on a condition
- Google Sheets SUMIF syntax
- Google Sheets SUMIF by a logical expression criterion: greater, less, or equal
- Google Sheets SUMIF: how to sum the not empty cells
- Google Sheets SUMIF: how to sum cells by exact match
- Google Sheets SUMIF: how to sum by a case-sensitive criterion
- How to expand SUMIF Google Sheets formula in a column: ARRAYFORMULA+SUMIF
- How to sum and group values by a certain condition in Google Sheets: QUERY+SUM
- Google Sheets SUMIF: how to sum by partial match
- How to sum cells by color with SUMIF in Google Sheets
- Google Sheets SUMIFS to sum a data range based on multiple criteria
- Google Sheets SUMIFS syntax
- SUMIFS Google Sheets formula example
- How to expand SUMIFS formula in Google Sheets
- SUMIF a data range based on multiple criteria with OR logic in Google Sheets
- SUMIF Google Sheets formula when any of the two criteria is met
- SUMIF Google Sheets formula when any of multiple criteria is met
- To wrap up: How to learn the sum without any formulas in Google Sheets
- How do I sum a cell based on a criteria in Google Sheets?
- How do you sum rows based on criteria?
- How do you auto sum rows in Google Sheets?
- How do I add a sum if a cell contains text in Google Sheets?
It is typed =SUMIF(range, criterion, [sum_range]) The condition is referred to as - If a number is greater than another number
`>` - If a number is smaller than another number
`<` - If a number or text is equal to something
`=`
The Note: The If not specified, the function calculates the sum of the same range as the condition. ## Example SUMIF functionFind the sum of Total stats for Grass type Pokemon: The condition is that the type is "Grass". Example SUMIF function, step by step: - Select the cell
`F3` - Type
`=SUMIF` - Click the SUMIF command
- Specify the range for the condition
`B2:B10` (the Type 1 values) - Type
`criterion` 0 - Specify the criteria (the cell
`criterion` 1, which has the value "Grass") - Type
`criterion` 0 - Specify the range for the sum
`criterion` 3 (the Total values) - Type
`criterion` 0 - Hit enter
The function now sums the Total stats for Grass type Pokemon. The function can be repeated for the other Pokemon types to compare them: Now, we can see the sum of total stats for the different types of Pokemon: The most primitive way to total cells in Google Sheets is to add the cell references to the formula and put plus ( 5) signs between them. For example:=B1+B2+B3+B4+B5 For longer ranges of cells, such as an entire column or row, this solution is not handy at all. Instead, you should use the SUM function or one of its derivatives: SUMIF and SUMIFS. Let’s check out how the native functions work and which use cases are a fit for them. Table of Contents ## Google Sheets SUM to total valuesSUM is a Google Sheets function to return a total of numbers or cells, or both specified numbers and cells. The SUM syntax has several variations depending on what you’re going to total. ## Google Sheets SUM syntax to total values
6 is a numeric value`=SUM(cell-range)`
## Google Sheets SUM basic formula example=sum(1,2,3,4,5) ## Google Sheets SUM to total a cell range## Google Sheets SUM syntax to total cells
7 is the range of cells to total. The range can be specified using commas for scattered cells like`=SUM(cell-range)` 8, or a colon for integral cell ranges like`=SUM(cell-range)` 9.`=SUM(cell-range)`
## Google Sheets SUM formula example for scattered cells=sum(B1,B3,C2,D1,D3) ## Google Sheets SUM formula example for an integral cell range=sum(B1:B5) ## Google Sheets SUM to total values and cells## Google Sheets SUM function syntax to total values and cells
## Google Sheets SUM formula example to total values and cells=sum(1,2,B3,B4:B5) ## How to SUM a column in Google SheetsNow you know the syntax of the SUM formulas, so let’s check out how they work on real-life data. We’ve imported some records from HubSpot to Google Sheets using Coupler.io.
So, with the data imported to Google Sheets, we can proceed to SUM formula examples. ## SUM a limited range from a column in Google SheetsIf you need to return the total of a limited range from a column, e.g. =sum(B1,B3,C2,D1,D3)0, a simple SUM syntax will do: =sum(B2:B182) If you want to return the total in the bottom of your column range, type the equal sign ( =sum(B1,B3,C2,D1,D3)1), and Google Sheets will suggest you the SUM formula itself.
## SUM an entire column in Google SheetsIf you need to total an entire column, specify the column range as follows: =sum(B2:B) Now, every new value within the column will be added to the total value, so you won’t have to manually tweak the SUM formula. ## How to SUM a row in Google SheetsFor this use case, we took a Profit and Loss report that we imported using the Xero Reports to Google Sheets integration. Now, let’s use SUM to total values from row 2. Here is the SUM formula to total the row values: 0## How to return SUM of multiple rows in one column in Google SheetsThe SUM formula above worked well, but is it possible to expand it to other rows using ARRAYFORMULA? Unfortunately, SUM + ARRAYFORMULA doesn’t expand: =sum(B1,B3,C2,D1,D3)2 will give a single number. But there is a workaround. ## Workaround#1: Sum multiple rows with ARRAYFORMULA in Google SheetsWith this workaround, you don’t need the SUM function at all. The idea is to manually add the columns and use ARRAYFORMULA to expand the results. Here is the formula for our case: 1
Read our Guide of Using ARRAYFORMULA in Google Sheets. ## Workaround#2: Sum multiple rows with ARRAYFORMULA, MMULT, TRANSPOSE, and COLUMN in Google SheetsFor this workaround, we’ll need to nest four functions: ARRAYFORMULA, MMULT, TRANSPOSE, and COLUMN. Here is how the formula looks: 2MMULT is an array function to multiply matrices. Our first matrix is =sum(B1,B3,C2,D1,D3)4. The second matrix must have the number of rows equal to the number of columns in the first matrix – five, in our case. This is how it should look: Instead of manually tailoring the matrix we need, we’ll use the combination of two functions, TRANSPOSE and COLUMN, in the following way: =sum(B1,B3,C2,D1,D3)5 In the end, wrap up everything with ARRAYFORMULA. The drawback of this workaround is that you have to specify the exact range of columns. ## How to return SUM of multiple columns in one row in Google SheetsSince we got the total column, let’s get the total row beneath the data set as well. MMULT nested with ARRAYFORMULA, TRANSPOSE, and ROW will help with that. Here is how it looks: 3Let’s wrap up with SUM for now, since we have more interesting cases with SUMIF and SUMIFS. ## Google Sheets SUMIF to sum a data range on a conditionSUMIF is a Google Sheets function to return a total of cells that match a single specific criterion. Put simply, the SUMIF function filters the range according to the specified criteria and sums values based on this filter. The syntax is the same as SUMIF Excel. ## Google Sheets SUMIF syntax 4=sum(B1,B3,C2,D1,D3) 6 is a condition to filter data.=sum(B1,B3,C2,D1,D3) 6 can be a number, a text string, a cell reference, as well as a variety of conditions, such as greater than or equal to.=sum(B1,B3,C2,D1,D3) 8 is a data range to examine based on the=sum(B1,B3,C2,D1,D3) 6=sum(B1:B5) 0 is a data range with values to total. This parameter is optional and can be omitted in cases when=sum(B1,B3,C2,D1,D3) 8 is the range with values to total.
Now, let’s check out SUMIF formula examples with different criteria cases. For this, we’ll use a dummy data range that was already featured in the blog post COUNTIF vs. COUNTIFS. It’s an extract of a sandwich store’s database, in which you can see Product, Price, Quantity, and other columns. By the way, this data set was imported from Airtable to Google Sheets. ## Google Sheets SUMIF by a logical expression criterion: greater, less, or equalUse one of the following logical operators to build a criterion for the SUMIF formula: Logical expressionLogical operatorgreater than>less than <equal to=greater than or equal to>=less than or equal to<=except for<>For example, let’s total the amount of products with the price equal to 10. 5Another formula example is to total the amount of products that are greater than or equal to 8. Bring to notice that this formula syntax is free of =sum(B1:B5)0, since the function will total the values from =sum(B1,B3,C2,D1,D3)8: 6## Google Sheets SUMIF: how to sum the not empty cellsThe use of the logical operator “except for” ( =sum(B1:B5)4) without any text string or cell reference means that the =sum(B1,B3,C2,D1,D3)6 is “not empty cells“. For example, 7## Google Sheets SUMIF: how to sum cells by exact matchThe exact match criterion can be specified as a text string, numeric value, or a cell reference. For example, here is the SUMIF formula to total the amount of a Sausage sandwich: 8## Google Sheets SUMIF: how to sum by a case-sensitive criterionSUMIF does differentiate between upper- and lower-case letters. That’s why in the formula example above, SUMIF totaled the amount of Sausage sandwich, though we specified =sum(B1:B5)6 as the criterion. If case sensitivity matters, you can use the following workaround: 9So, our formula will look like this and return “0” since there is no match to the criterion: =sum(1,2,3,4,5)0 ## How to expand SUMIF Google Sheets formula in a column: ARRAYFORMULA+SUMIFLet’s expand the SUMIF formula to calculate the total amount of other products. Here is the syntax you should use: =sum(1,2,3,4,5)1 In our case, the SUMIF formula will look as follows: =sum(1,2,3,4,5)2
## How to sum and group values by a certain condition in Google Sheets: QUERY+SUMHere is an alternative solution to the SUMIF formula above. The idea is to extract unique values from the Product column and return the total amount of each product with a single formula. The QUERY function can easily do that as follows: =sum(1,2,3,4,5)3 Read our blog post for more about using QUERY in Google Sheets. ## Google Sheets SUMIF: how to sum by partial matchThe partial match criterion is when you need to total cells in =sum(B1:B5)0 if the cells in =sum(B1,B3,C2,D1,D3)8 contain specific characters. To tailor a partial match criterion, you’ll need to use the following wildcards: - Question mark (
0) to disguise every single character of a text string. For example,`=SUM (value1, value2,...,cell-range)` 1 means that the`=SUM (value1, value2,...,cell-range)` =sum(B1,B3,C2,D1,D3) 6 is a 6-letter word that ends with 3.`=SUM (value1, value2,...,cell-range)` - Asterisk (
4) to disguise any number of characters of a text string. For example,`=SUM (value1, value2,...,cell-range)` 5 means that that the`=SUM (value1, value2,...,cell-range)` =sum(B1,B3,C2,D1,D3) 6 is any word that contains 3.`=SUM (value1, value2,...,cell-range)` - You can also concatenate wildcards and cell references. For example,
8 means that the`=SUM (value1, value2,...,cell-range)` =sum(B1,B3,C2,D1,D3) 6 is a text string that ends with the value from the C5 cell.
Let’s check out the common examples: SUMIF formula to total all items that contain “cheese” in their naming: =sum(1,2,3,4,5)4 And here is what this SUMIF formula will look if we use a cell reference concatenated with wildcards: =sum(1,2,3,4,5)5 ## How to sum cells by color with SUMIF in Google SheetsGoogle Sheets doesn’t have this feature built-in. However, you can do it yourself using the Script editor. It won’t take more than a minute. - Open Script editor in your spreadsheet: go to Tools => Script editor
- Open a new script file: go to File => New => Script file. Name the file as you want.
- Copy and paste the following script to replace the original code.
=sum(1,2,3,4,5)6 Click Save (you might be offered to give a name to your project) and get back to the Google Sheets doc. Now, you have the SUMBYCOLOR function with the following syntax: =sum(1,2,3,4,5)7 =sum(B1:B5) 0 is a data range with values to total, as well as to examine based on the=sum(1,2,B3,B4:B5) 1.=sum(1,2,B3,B4:B5) 1 is a colored cell that defines the background color to filter and sum the data.
Here is a formula example: =sum(1,2,3,4,5)8 Kudos to ExtendOffice for the workaround. Check out their blog post if you also want to count cells by color. How to Link Data Between Multiple Spreadsheets ## Google Sheets SUMIFS to sum a data range based on multiple criteriaSUMIFS is the youngest child in the SUM family. It lets you total values considering two or more criteria across different ranges. ## Google Sheets SUMIFS syntax=sum(1,2,3,4,5)9 The parameters are the same as with SUMIF, but you can add multiple criteria to a single formula. SUMIFS works by the AND logic: to get the total sum, all the specified criteria must be met, otherwise the formula will return “0”. ## SUMIFS Google Sheets formula exampleLet’s get back to our data set and total the amount of items by the following criteria: - Product name must contain “cheese“
- Product price must be less than $10
Here is the SUMIFS formula: 0## How to expand SUMIFS formula in Google SheetsSUMIF can be nested with ARRAYFORMULA to expand the results. With SUMIFS, you can’t do that. However, if you badly need to expand SUMIFS, check out the . ## SUMIF a data range based on multiple criteria with OR logic in Google SheetsSUMIFS returns a sum of values if all criteria are met based on the AND logic. The OR logic is when any of the specified criteria is met. This can be done with an advanced SUMIF formula. ## SUMIF Google Sheets formula when any of the two criteria is met 1This is the best solution when you need to SUMIF by different criteria for different =sum(1,2,B3,B4:B5)3. For example, we need to sum the values by one of the following criteria: - Product name must contain “cheese“
- Product price must be greater than $14
As you can see, none of the products in our data set has the price greater than $14. So, the SUMIF formula returns the sum of values that match the first criterion only: 2## SUMIF Google Sheets formula when any of multiple criteria is metFor multiple criteria within a single range, it’s not handy to use the approach above. So, you’d better use the following formula syntax: 3Note: The formula works for a single =sum(B1,B3,C2,D1,D3)8 only. For example, we need to sum the values by one of the following product price criteria: - Equal to $13
- Less than $9
- Greater than $14
Here we go: 4## To wrap up: How to learn the sum without any formulas in Google SheetsYou’ve read the article till the end?! You’re a person of worth and deserve a tiny bonus. If you need to learn the total of specific cells right here, right now, you don’t need any formulas at all. Simply select the cells you want to sum and check out a new tab that appeared near the Explore button. Here is your total sum! ## How do I sum a cell based on a criteria in Google Sheets?Google Sheets has two functions to add up numbers based on conditions: SUMIF and SUMIFS. The former evaluates just one condition while the latter can test multiple conditions at a time.. greater than (>). less than (<). greater than or equal to (>=). less than or equal to (<=). ## How do you sum rows based on criteria?If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."
## How do you auto sum rows in Google Sheets?Note: This feature doesn't work for some numbers or currency formats.. On your computer, open a spreadsheet in Google Sheets.. Highlight the cells you want to calculate.. In the bottom right, find Explore. . Next to Explore, you'll see "Sum: total.". To see more calculations, click Sum. Average. Minimum. Maximum. Count.. ## How do I add a sum if a cell contains text in Google Sheets?Google Sheets Sum If Cell Contains Text. In an empty cell, type the SUMIF formula. ... . Select the range to which you want to apply the criterion. ... . Add the criterion you want to apply to the selected range. ... . Next, select the range with the values you want to sum if it's different from the first range selected. ... . That's it.. |