You can create a formula to calculate values in your worksheet by using a function. For example, the formulas =SUM(A1:A2) and SUM(A1,A2) both use the SUM function to add the values in cells A1 and A2. Formulas always start with an equal sign (=).

Click the cell where you want the formula.

To start the formula with the function, click in the formula bar or start typing the formula in the cell.
Tip: For a list of available functions, see functions (alphabetical) or functions (by category).

After you complete the arguments for the formula, press Enter to see the formula result in the cell.
Tip: If you frequently use functions, you can enter your formulas directly on the worksheet. After you type the equal sign (=) and the function name, you can see information about the formula syntax and the function arguments.
Examples
Use the data here to work with examples of formulas using a function. You can see and change formulas, and enter your own formulas.
Copy the table to cell A1 in a blank worksheet to work with these examples of formulas that use functions.
Data 

5 
4 

2 
6 

3 
8 

7 
1 

Formula 
Description 
Result 
'=SUM(A:A) 
Adds all numbers in column A 
=SUM(A:A) 
'=AVERAGE(A1:B4) 
Averages all numbers in the range A1:B4 
=AVERAGE(A1:B4) 