Create a formula by using a function
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 in which you want to enter the formula.

To start the formula with the function, click Insert Function on the formula bar .
Excel inserts the equal sign (=) for you.

In the Or select a category box, select All.
If you are familiar with the function categories, you can also select a category.
If you're not sure which function to use, you can type a question that describes what you want to do in the Search for a function box (for example, "add numbers" returns the SUM function).
Tip For a list of available functions, see Excel functions (alphabetical) or Excel functions (by category). 
In the Select a function box, select the function that you want to use, and then click OK.

In the argument boxes that are displayed for the function you selected, enter the values, text strings, or cell references you want.
Instead of typing cell references, you can also select the cells that you want to reference. Click to minimize the dialog box, select the cells you want to reference, and then click to expand the dialog box again.
Tip For more information about the function and its arguments, click Help on this function. 
After you complete the arguments for the formula, click OK.
Examples
Copy the table to cell A1 in a blank worksheet in Excel 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) 