SUM function
The SUM function, one of the math and trig functions, adds all of its arguments.
Syntax: SUM(number1,[number2],...)
For example:

=SUM(A2,A3)

=SUM(A5,A6, 2)
Argument name 
Description 
number1 (Required) 
The first number you want to add. The number can be like 4, a cell reference like B6, or a cell range like B2:B8. 
number2 (Optional) 
This is the second number you want to add. You can specify up to 255 additional numbers in this way. 
Examples
To use these examples in Excel, select the data in the following table and press Ctrl+C. In Excel, click cell A1 in a new worksheet and press Ctrl+V.
Data 

5 

15 

30 

'5 

TRUE 

Formula 
Description 
=SUM(A2,A3) 
Adds the value in cells A2 and A3. The result is 10. 
=SUM(A2:A4,15) 
Adds the values in cells A2 through A4 first, and then adds 15. The result is 55. 
=SUM("5", 15, TRUE) 
Adds 5, 15 and 1. The text value "5" is first translated into a number, and the logical value TRUE is first translated into the number 1. The result is 21. 
=SUM(A5,A6, 2) 
Adds the values in cells A5 and A6, and then adds 2 to that result. Because nonnumeric values in references aren't translated— the value in cell A5 ('5) and the value in cell A6 (TRUE) are both treated as text—the values in those cells are ignored. The result is 2. 
Common Problems
Problem 
What went wrong 
Some numbers aren't added. 
If an argument is a cell range or reference, only numeric values in the reference or range can be added. Empty cells, logical values like TRUE, or text are ignored. 
The #Name? error value appears instead of the expected result. 
This usually means that the formula is misspelled. 
Related

The SUMIF function adds only the values that meet a single criteria.

The SUMSQ function sums the values after it performs a mathematical square operation on each of them.

See a video on how to use the SUM function.