Adding some cells from a row, column or array is one of the most common things one can do in Google Sheets. The SUM function in Google Sheets can be utilized in such cases. The SUM function can add numbers, numbers stored as texts, or unique numbers stored for text values. Here, in this article, I will demonstrate a few examples of how to use the SUM function in Google Sheets.
A Sample of Practice Spreadsheet
What Is SUM Function in Google Sheets?
The SUM function is used to return the sum of a series of numbers and/or cells.
The SUM function’s syntax is as follows:
=SUM (value1, [value2, ...])
||Required||The first number or range to add together|
||Optional||Additional numbers or ranges to be added to value1|
The formula SUM (3,5,8) will have an output of 16.
6 Examples to Use SUM Function in Google Sheets
First, let’s know about our dataset. We have considered the performance of students from four different schools. Here, we can apply the SUM function to determine the total number of students from various categories. Now, let’s go through the examples.
1. Add Values Directly
Here, we will calculate the total number of students who have outstanding performance.
- For that, go to Cell C10 (where you want to calculate the total) and type the following formula, and press Enter key-
2. Sum Up Cells of a Row
Entering every value like in the previous method isn’t very efficient in large datasets. Also, changing any value from the dataset will not change the value of the output. We can insert the values as a range instead to create a more flexible and dynamic dataset.
Here, I’ll be calculating the total number of students in the School of Science.
- For that, go to Cell G6 and type in the following formula and then press Enter key-
Here, the array C6:F6 indicates the value of every cell from Cell C6 to Cell F6.
3. Add Cells of a Column
Here, we will use the SUM formula to calculate the total number of students in consideration.
- Follow the previous method to calculate the total number of students in the School of Science. Then use the Fill Handle icon to copy the formula into other cells of the column.
- This will calculate the total number of students in other schools.
- Now, in Cell G10, type in the following formula and press Enter. This will calculate the total number of students in consideration-
4. Add Specific Cells
We can use the SUM function to exclude a few cells while adding the values from a range. For example, let’s calculate the number of students who have outstanding performance but are not from the School of Economics.
- To calculate this, go to Cell G12 and type in the following formula and then press Enter Key-
5. Sum Up Cells of an Array
We can include both rows and columns in our range for the SUM formula.
- Instead of method 3, we can type the following formula in Cell G10 and press Enter key to calculate the total number of students in consideration-
6. Sum Unique Numbers Stored for Text Values
We can use the SUM function combined with the VLOOKUP function and the ARRAYFORMULA function to add unique numbers stored for text values. For that, we have taken a new dataset where the result for 4 different games is shown for 5 different clubs. The points assigned for each type of result are also indicated in a different table. We need to calculate the total points for each club.
- Select Cell G5 and type in the following formula and then press Enter key.
The VLOOKUP function searches down the first column of the range I5:J7 for search key C5:F5 and return specified cells from 2nd column of the range.
Next, the SUM function returns the sum of the numbers returned by the VLOOKUP function.
After that, the ARRAYFORMULA function helps the non-array function VLOOKUP to return an array to the SUM function.
- Now, use the Fill Handle to copy the formula in other cells of the column.
- Thus, we can sum unique numbers stored for text values.
How to Automatically Add Numbers in Google Sheets
One can add numbers automatically with every entry in the datasheet if he/she types the formula before entering the values.
- Select Cell G5 and type in the following formula and press Enter key. Since there is no entry yet in the array C6:F6 the output is 0.
- Now, select Cell C6 and start entering data for the array. As soon as you enter the data in Cell C6 and press Enter or Tab key, the value in Cell G10 will change.
- Each time you enter/change a value in that array, the value in Cell G6 will also change.
What to Do When SUM Function Is Not Working in Google Sheets
Sometimes some formulas in Google Sheets might not show the required result although every argument of the formula has been inserted correctly. There can be various reasons behind this problem. But here we discuss one of the most common instances where the SUM function doesn’t provide the required output and how we can solve this problem.
- Here, in this datasheet, we have inserted the arguments correctly in the SUM function; but instead of the accurate output of 65, the SUM function has provided us with an output of 0.
- But if you select the array of the argument and go to the More Formats option from the Clipboard, you will see that instead of Number or Automatic, the data format is Plain Text. This is the reason behind an output of 0.
- Now, we can change the format to Automatic or Numbers. But instead of changing the dataset, we can combine the SUM function with the ARRAYFORMULA function and the VALUE function to calculate the sum. For that, select Cell G5 and type in the following formula, and then press Enter key.
The VALUE function converts the string entries into numbers.
Then the SUM function adds the numbers returned by the VALUE function.
Finally, the ARRAYFORMULA function helps the non-array function VALUE to return an array to the SUM function.
Things to Be Considered
- Use Comma (,) between arguments of the SUM function.
- Use the ARRAYFORMULA function in cases where a non-array function has to return an array.
This concludes our article to learn about how to use the SUM function in Google Sheets. I hope the provided examples will be sufficient for your requirements. Feel free to leave any comments or advice in the comment box.