## How to use the SUM function

The SUM function in Excel allows you to add values, the function returns the sum in the cell it is entered in. The SUM function is cleverly designed to ignore text and boolean values, adding only numbers.

### Excel Function Syntax

SUM(*number1*, [*number2]*, ...)

#### Arguments

number1 |
Required. A constant, cell reference or an array that contains numerical values you want to add. |

[number2] |
Optional. Up to 254 additional arguments. |

The SUM function lets you add values in cell ranges, arrays, constants. You can have up to 255 different arguments.

#### Table of Contents

- Add values in a cell range
- Add values in an array
- Multiple cell ranges
- Numbers and text
- Boolean values
- Expanding cell reference
- SUM with a condition
- SUM with multiple conditions
- SUM - VBA example
- Download excel *.xlsm file
- SUM formula examples

### Add values in a cell range

The SUM function lets you add values in a cell range, like this = SUM(B3:B7), instead of adding values in a formula using the plus sign, like this =B3+B4+B5+B6+B7.

The SUM function lets you type one or multiple cell ranges, in this example only cell range B3:B7 is entered as an argument. See above picture.

### Add values in an array

An array is multiple values enclosed with a beginning and ending curly bracket, you can easily convert a cell range to an array. See instructions below.

Select a cell and type =SUM(B3:B9)

Click in the formula bar and select B3:B9.

Press F9 and the cell range is converted to an array, like this: =SUM({5,3,6,4,2})

Press Enter.

The SUM function adds the values in the array 5+3+6+4+2 = 20. When you convert a cell range to values you hard-code or create constants in your formula, meaning they never change unless you change the values in the formula.

Cell references on the other hand change if you change the values on a worksheet.

I recommend reading this post: Learn the basics of Excel arrays , if you want to learn more about array formulas.

### Add values in multiple cell ranges

If you want to add values in multiple cell ranges you simply use a comma between arguments. Check your regional settings if a comma doesn't work for you. You are allowed to have up to 255 arguments in one SUM function.

### Add numbers and ignore text

The formula in cell B8 adds the values in cell range B3:B7. 5 + AA + 6 + 4 +2 = 17. The SUM function ignores text strings, in this case AA.

### Adding boolean values

Cell range B3:B7 contains boolean values, TRUE or FALSE, however SUM can't add boolean values. Don't worry, there is a work-around.

There are multiple solutions to this problem, here are a few:

=SUM(--(B3:B7))

=SUM(B3:B7+0)

=SUM(B3:B7*1)

They need to be entered as array formula, because they do calculations to a cell range containing multiple cells. Instructions below on how to enter an array formula.

- Double click cell B8
- Type =SUM(B3:B7*1)
- Press CTRL + SHIFT simultaneously
- Press Enter once
- Release all keys

The formula in the formula bar changes to {=SUM(B3:B7*1)}

These curly brackets tells you that you have created an array formula, don't enter these characters yourself.

The formula returns 2 because TRUE equals 1 and FALSE equals 0. 1+0+1+0+0 = 2.

### Sum using an expanding cell reference

The following picture shows you numbers in column B.

Enter this formula in cell C3:

=SUM($B$3:B3)

Make sure you get the dollar signs right, they are important. The cell reference changes as you copy the formula and paste it to cells below.

Select cell C4 and see how the formula changed in the formula bar. The part of the cell reference without dollar signs changed from B3 to B4.

That part is a relative cell reference and the part with dollar signs is an absolute cell reference.

Read more here: Absolute and relative cell references

### Sum with a condition [array formula]

The picture below shows you two columns. Column B contains text values and column C contains numbers.

The formula in cell F3 lets you add numbers in column C if their adjacent value is equal to the value in cell F2:

This formula is an array formula, read Boolean values above how to enter an array formula.

The equal sign in B3:B10=F2 lets you compare the values in cell range B3:B10 with the value in cell F2. The equal sign is a logical operator, often used in IF functions.

This logical test returns an array of boolean values, in this case {FALSE; TRUE; TRUE; FALSE; TRUE; FALSE; FALSE; FALSE} The parentheses (B3:B10=F2) makes sure this part of the formula is calculated first before multiplying with the numbers in cell range C3:C10.

(B3:B10=F2)*C3:C10 becomes {FALSE; TRUE; TRUE; FALSE; TRUE; FALSE; FALSE; FALSE}*C3:C10 and returns {0; 1; 10; 0; 8; 0; 0; 0}

The SUM function then adds the number in the array: SUM({0; 1; 10; 0; 8; 0; 0; 0}) and returns 19 in cell F3. 1+10+8 = 19

**Tip!** The powerful excel table can do all this for you:

Excel defined table - SUM with criteria

### Sum with multiple conditions [array formula]

Adding a second condition to the formula is easy. Simply add your condition to the formula enclosed with parentheses.

### SUM - VBA example

Sub HLP() MsgBox Application.WorksheetFunction.Sum(Range("B3:B7")) End Sub

### Download excel *.xlsm

### Articles with the 'SUM' Function

The following 14 articles have formulas that contain the SUM function.

This article describes how to count unique distinct values. What are unique distinct values? They are all values but duplicates are [โฆ]

Sum values between two dates and based on a condition

In this post, I will provide a formula to sum values in column (Qty) where a column (Date) meets two [โฆ]

Count how many times a string exists in a cell range (case insensitive)

Question: How do I count how many times a word exists in a range of cells? It does not have [โฆ]

Count text string in a range (case sensitive)

Question: How do I count the number of times a text string exists in a column? The text string may [โฆ]

Count overlapping days in multiple date ranges

The MEDIAN function lets you count overlapping dates between two date ranges. If you have more than two date ranges [โฆ]

The formula in cell D3 adds all unique numbers in cell range B3:B12 and returns the total. Unique values are all [โฆ]

I will now demonstrate with the following table how to add check-boxes and sum enabled check-boxes using a formula. Add [โฆ]

Question: It's easy to sum a list by multiple criteria, you just use array formula a la: =SUM((column_plane=TRUE)*(column_countries="USA")*(column_producer="Boeing")*(column_to_sum)) But all [โฆ]

Sum cells containing numbers and text based on a condition

Question: I want to sum cells that have a "C" and a decimal number. The cells have other numbers and [โฆ]

The SUM function in cell D3 uses only a single cell reference and still manages to sum current and previous [โฆ]

### Functions in 'Math and trigonometry'

The SUM function function is one of many functions in the 'Math and trigonometry' category.

Converts negative numbers to positive numbers, in other words, the ABS function removes the sign. Excel Function Syntax ABS(number) Arguments [โฆ]

The ACOS function calculates the arccosine, or inverse cosine, of a number. Formula in cell C3: =ACOS(B3) Excel Function Syntax [โฆ]

The ACOSH function calculates the inverse hyperbolic cosine of a number. Formula in cell C3: =ACOSH(B3) Excel Function Syntax ACOSH(number) [โฆ]

The ACOT function calculates the inverse cotangent of a number. The returned angle is given in radians from 0 (zero) [โฆ]

The ACOTH function calculates the inverse hyperbolic cotangent of a number. Formula in cell C3: =ACOTH(B3) Excel Function Syntax ACOTH(number) [โฆ]

How to use the AGGREGATE function

The AGGREGATE function allows you to calculate different specific functions to a list or database. A special AGGREGATE function feature [โฆ]

The ASIN function calculates the arcsine of a number. The angle is in radians and is between -pi/2 to pi/2. =ASIN(B3) Excel [โฆ]

The ASINH function calculates the inverse hyperbolic sine of a number. =ASINH(B3) Excel Function Syntax ASINH(number) Arguments number Required. Any [โฆ]

The ATAN function calculates the arctangent of a number. The returned angle is in radians between -pi/2 to pi/2. =ATAN(B3) Excel [โฆ]

The ATAN2 function calculates the arctangent of an angle using specific x- and y-coordinates. The returned angle is in radians [โฆ]

The ATANH function calculates the inverse hyperbolic tangent of a number. =ATANH(B3) Excel Function Syntax ATANH(number) Arguments number Required. Must be [โฆ]

The BASE function converts a number into a text representation with a given radix (base). Formula in cell C3: =BASE(10, [โฆ]

How to use the CEILING function

The CEILING function rounds a number up to its nearest multiple. The number is rounded down if both the number [โฆ]

How to use the COMBIN function

The COMBIN function returns the number of combinations for a specific number of elements out of a larger number of [โฆ]

How to use the COMBINA function

The COMBINA function calculates the number of combinations for a given number of elements from a larger group of elements. Formula in [โฆ]

The COS function calculates the cosine of an angle. Formula in cell C3: =COS(B3) Excel Function Syntax COS(number) Arguments number [โฆ]

The COSH function calculates the hyperbolic cosine of a number. Formula in cell C3: =COSH(B3) Excel Function Syntax COSH(number) Arguments [โฆ]

The COT function calculates the cotangent of an angle specified in radians. Formula in cell C3: =COT(B3) Excel Function Syntax [โฆ]

The COTH function calculates the hyperbolic cotangent of a hyperbolic angle. The function has been available since Excel 2013. Formula [โฆ]

The CSC function calculates the cosecant of an angle (radians). The CSC function returns the same value as 1/SIN(number). Formula in [โฆ]

How to use the DECIMAL function

The DECIMAL function converts a text representation of a number in a given base into a decimal number. Formula in [โฆ]

How to use the DEGREES function

The DEGREES function calculates degrees from radians. Formula in cell C3: =DEGREES(B3) Excel Function Syntax DEGREES(angle) Arguments angle Required. The [โฆ]

The EVEN function rounds a number up to the nearest even whole number. An even number is a number that [โฆ]

Returns e raised to the power of a number, e equals 2.71828182845904. Example, e^2 equals 7.389056099 Formula in cell C3: [โฆ]

The FACT function returns the factorial of a number. Formula in cell C3: =FACT(B3) Example, 3! = 3*2*1 = 6 [โฆ]

How to use the FACTDOUBLE function

The FACTDOUBLE returns the double factorial of a number. Formula in cell C3: =FACTDOUBLE(B3) Excel Function Syntax FACTDOUBLE(number) Arguments number [โฆ]

How to use the FLOOR.MATH function

The FLOOR.MATH function rounds a number down to the nearest integer or to the nearest multiple of significance. Formula in [โฆ]

How to use the FLOOR.PRECISE function

The FLOOR.PRECISE function rounds a number down to the nearest integer or nearest multiple of significance. Excel Function Syntax FLOOR.PRECISE(number, [โฆ]

The GCD calculates the greatest common divisor that divides all given arguments without a remainder. Formula in cell D3: =GCD(B3:B4) Excel [โฆ]

Removes the decimal part from positive numbers and returns the whole number (integer) except negative values are rounded down to [โฆ]

The LCM function calculates the least common multiple. The least common multiple is the smallest positive integer that is a [โฆ]

The LN function calculates the natural logarithm of a number. Natural logarithms are based on the constant e. Formula in [โฆ]

The LOG function calculates the logarithm of a number to a specific base. Formula in cell C3: =LOG(10) Excel Function [โฆ]

The LOG10 function calculates the logarithm of a number using the base 10. Formula in cell C3: =LOG10(B3) Excel Function [โฆ]

How to use the MINVERSE function

The MINVERSE function calculates the inverse matrix for a given array. This function is useful for solving equations with multiple variables. [โฆ]

The MMULT function calculates the matrix product of two arrays, an array as the same number of rows as array1 and [โฆ]

The Mod function returns the remainder after a number is divided by divisor. The Mod function is short for the Modulo [โฆ]

How to use the MROUND function

The MROUND function calculates a number rounded to a given multiple. Formula in cell D3: =MROUND(B3,C3) Excel Function Syntax MROUND(number, [โฆ]

How to use the MULTINOMIAL function

The MULTINOMIAL function calculates the ratio of the factorial of a sum of values to the product of factorials. Formula [โฆ]

The MUNIT function calculates the identity matrix for a given dimension. Array formula in cell B2: =MUNIT(3) The formula above returns an [โฆ]

The PI function returns the number pi (ยถ). Formula in cell B3: =PI() Excel Function Syntax PI() Arguments PI function [โฆ]

The POWER function calculates a number raised to a power. Excel Function Syntax POWER(number, power) Arguments number Required. The number [โฆ]

How to use the PRODUCT function

The PRODUCT function returns the product of the numbers given in the argument. Formula in cell D3: =PRODUCT(B3:C3) Excel Function [โฆ]

How to use the RADIANS function

The RADIANS function converts degrees to radians. Formula in cell C3: =RADIANS(B3) Excel Function Syntax RADIANS(angle) Arguments angle Required. The [โฆ]

The RAND function calculates a random real number greater than or equal to 0 and less than 1. The function [โฆ]

How to use the RANDBETWEEN function

Returns a random whole number between the numbers you specify. This function is volatile meaning a new random number is [โฆ]

How to use the ROUNDDOWN function

The ROUNDDOWN function calculates a number rounded down based on the number of digits to which you want to round [โฆ]

How to use the ROUNDUP function

The ROUNDUP function calculates a number rounded up based on the number of digits to which you want to round [โฆ]

The SEC function calculates the secant of an angle. Formula in cell E3: =SEC(B3) Excel Function Syntax SEC(number) Arguments number [โฆ]

The SECH function calculates the hyperbolic secant of an angle. Formula in cell C3: =SECH(B3) Excel Function Syntax SECH(number) Arguments [โฆ]

How to use the SERIESSUM function

The SERIESSUM function calculates the sum of a power series based on the following formula: SERIESSUM(x, n, m, a) = [โฆ]

The SIGN function returns the sign of a number. 1 for a positiv number, 0 (zero) for a 0 (zero) [โฆ]

The SIN function calculates the sine of an angle. Formula in cell C3: =SIN(B3) Excel Function Syntax SIN(number) Arguments number [โฆ]

The SINH function calculates the hyperbolic sine of a number. Formula in cell C3: =SINH(B3) Excel Function Syntax SINH(number) Arguments [โฆ]

The SQRT function calculates the positive square root. Formula in cell C3: =SQRT(B3) Excel Function Syntax SQRT(number) Arguments number Required. [โฆ]

The SUM function in Excel allows you to add values, the function returns the sum in the cell it is [โฆ]

The SUMIF function sums values based on a condition. The condition can be applied to the values being summed or [โฆ]

How to use the SUMIFS function

The SUMIFS function in cell D11 adds numbers from column D based on criteria applied to column B and C. [โฆ]

How to use the SUMPRODUCT function

The SUMPRODUCT function calculates the product of corresponding values and then returns the sum of each multiplication.

The SUMSQ function calculates the sum of the squares of the arguments. Formula in cell D3: =SUMSQ(B3:B5) 2^2 = 4, [โฆ]

How to use the SUMX2MY2 function

The SUMX2MY2function calculates the sum of the difference of squares of corresponding values in two arrays. Formula in cell F3: [โฆ]

How to use the SUMX2PY2 function

The SUMX2PY2 function calculates the sum of the sum of squares of corresponding values in two arrays. The sum of [โฆ]

How to use the SUMXMY2 function

The SUMXMY2 function calculates the sum of squares of differences of corresponding values in two arrays. Formula in cell F3: [โฆ]

The TAN function calculates the tangent of an angle. Formula in cell C3: =TAN(B3) Excel Function Syntax TAN(number) Arguments number [โฆ]

The TANH function calculates the hyperbolic tangent of a number. Formula in cell C3: =TANH(B3) Excel Function Syntax TANH(number) Arguments number [โฆ]

The TRUNC function removes the fractional part of the number to an integer. Formula in cell C3: =TRUNC(B3) Excel Function [โฆ]

Learn how to use the SUBTOTAL function

The picture above shows row 4 and row 8 hidden, the SUM argument 9 sums all values in C3:C11 whereas [โฆ]

The quotient function returns the integer portion of a division. Example, 5/2 = 2.5. The integer is 2. Excel Function [โฆ]

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form