# Summation in Sheets. How to Total a Column in Google Sheets

## How to Total a Column in Google Sheets #

Calculating the total or sum of a column in Google Sheets is a common task that comes in handy for various purposes, such as balancing your monthly expenses, keeping track of sales figures, or analyzing data. In this article, we will guide you through two methods to achieve this: manual calculation and using a custom Google Apps Script.

### Manual Calculation #

Manually totaling a column in Google Sheets is a straightforward process. Follow the steps below:

1. Open your Google Sheet and navigate to the sheet that contains the column you want to sum.
2. Ensure that the column you want to sum contains only numerical values. If there are any non-numerical entries, the sum will yield an error.
3. Select an empty cell where you want the sum to appear, typically below the column you want to sum.
4. Type the formula "=SUM(column range)" into the selected cell, replacing "column range" with the actual range of cells you want to add up.
• For example, if you want to sum the values from cell A2 to A10, type "=SUM(A2:A10)" in the cell.
5. Press Enter.

Once you've completed these steps, the cell you selected will display the sum or total of the specified range. The value in this cell will update automatically if any changes are made to the values within the column.

### Google Apps Script Method #

If you find yourself frequently calculating the sum of a column in Google Sheets or you need to automate the process, you can use Google Apps Script to create a custom script. This allows you to implement a function that calculates the sum with a single click.

To create a Google Apps Script for summing a column, follow these instructions:

2. Select "Apps Script."

3. In the Apps Script editor, delete any existing code and replace it with the following script:

``function sumColumn() {  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();  var range = sheet.getRange("column range"); // Replace with the actual range of cells you want to sum  var sum = 0;  range.getValues().forEach(function(row) {    sum += row;  });  return sum;}``
4. Save the script by clicking on the floppy disk icon or pressing `Ctrl + S`.

5. Close the Apps Script editor.

To use the custom script and calculate the sum of a column, follow these steps:

1. Navigate to the sheet containing the column you want to sum.
2. Ensure you have an empty cell ready to display the sum.
3. Click on the "Extensions" tab in the menu bar.
4. Select "Apps Script."
5. Find and click on the function name "sumColumn" and then click the "Run" button.
6. After a brief moment, the sum will be displayed in the designated cell.

### Use Case Examples #

1. Monthly Expenses: Suppose you have a column in Google Sheets where you record your monthly expenses. By totaling the column, you can easily keep track of your total expenditure and monitor your spending habits.

2. Sales Figures: If you manage a business and track your daily or monthly sales figures in a column, summing the column allows you to quickly calculate your total revenue and analyze sales trends.

3. Inventory Management: Say you maintain a Google Sheet to record your inventory levels in a column. By summing the column, you can monitor the total quantity on hand and easily identify when reordering is necessary.

By mastering these methods for totaling a column in Google Sheets, you will have the ability to efficiently manage and analyze your data on the go.

Applying a formula to an entire column can be useful when you need to perform calculations on multiple cells in Google Sheets.