SUM
The SUM function returns the sum of a collection of numbers.
To learn the basics about using formulas and functions, see Formulas overview and Functions overview.
SUM(value, value…)
value: A number value, date/time value, or duration value. All values must be of the same type.
value…: Optionally include one or more additional values.
Notes
Any referenced cells must only include numeric values.
There is one case where all values do not have to be of the same value type. If exactly one date/time value is included, any number values are considered to be numbers of days and all numbers and duration values are added to the date/time value.
Date/time values can’t be added together, so only one date/time value (as discussed above) is permitted.
The values can be in individual cells, ranges of cells, or included directly as arguments to the function.
You can also create a running total (also called a cumulative sum) using an expanding range, which uses a combination of absolute (fixed) and relative cell references. A running total is especially useful if your data may change over time. For example, you can use a running total so you can see total sales change as you add sales for each month to your table. To learn more about absolute and relative cell references, see Refer to cells in formulas.
Examples |
---|
The following table tracks sales of different kinds of fruits in a store: |
A | B | C | |
---|---|---|---|
1 | Fruit | Amount | Variety |
2 | Blueberries | 10 | Berries |
3 | Raspberries | 20 | Berries |
4 | Strawberries | 60 | Berries |
5 | Lemons | 10 | Citrus |
6 | Limes | 30 | Citrus |
7 | Oranges | 40 | Citrus |
Use SUM to add number values |
---|
SUM can be used to add any number of values, like a calculator. The following are some ways to use the SUM function: |
Add numbers directly: This formula returns 90. |
Add up the values in individual cells: This formula returns 100. |
Add up the values in a range of cells: This formula returns 160. |
Add up a combination of individual numbers, cell values, and ranges: This formula returns 120. |
Add up the values in an entire column: This formula returns 170. |
Try it |
---|
To see the SUM function used in a Numbers spreadsheet, create a new spreadsheet with the "Simple Budget" template. Change some values in the budget and see how the result in the "Total" row changes. Explore the function used in the "Total" row. |
Use SUM with other functions |
---|
SUM can be used with many other functions, including ROUND and IF. The following table contains values you can use for the examples below: |
A | B | |
---|---|---|
1 | 223,248.1 | 608,346.018 |
2 | 68,425.25 | 7,237,456.54 |
3 | 362,947.9 | 4,567,896.13 |
You can use the following formula to return 654,621.3; which is the SUM of all values in column A, rounded to one decimal place: |
SUM can also be used as part of an IF expression. For example, in this formula, the values of cells A2 and B2 are first compared; since column B is greater, the values in column B are added and the sum, 12,413,698.688, is returned: |
Take it further with SUMIF and SUMIFS |
---|
You can also use SUMIF and SUMIFS to add cells based on certain criteria. |
The SUMIF function adds values within a range only if they meet a single condition. Using the data above, to add the amount of just the berries sold, you can search for the term "Berries" in the Variety column (C2:C7), and then add the corresponding values in the Amount column (B2:B7). The formula below returns a sum of 90: |
The SUMIFS function adds values that meet multiple criteria. Using the data above, to add the amount of just the citrus fruit sold with an amount larger than 10, you can search for the term "Citrus" in the Variety column (C2:C7), and then add the corresponding values in the Units column (B2:B7) only if they are larger than 10. The following formula returns a sum of 70: |
Additional examples |
---|
=SUM(A1:A4) adds the numbers in cells A1, A2, A3, and A4. =SUM(A1:D4) adds the numbers in the square collection of the sixteen cells in the range A1:D4. =SUM(A1:A4, 100) adds the numbers in A1, A2, A3, and A4 and the number 100. |