Formulas in MS Excel
Formulas are the Bread and butter of worksheet. Without formula, worksheet will be just simple tabular representation of data. A formula consists of special code, which is entered into a cell. It performs some calculations and returns a result, which is displayed in the cell.
Formulas use a variety of operators and worksheet functions to work with values and text. The values and text used in formulas can be located in other cells, which makes changing data easy and gives worksheets their dynamic nature. For example, you can quickly change the data in a worksheet and formulas works.
Elements of Formulas
A formula can consist of any of these elements −
Mathematical operators, such as +(for addition) and *(for multiplication)
Example −
=A1+A2 Adds the values in cells A1 and A2.
Values or text
Example −
=200*0.5 Multiplies 200 times 0.15. This formula uses only values, and it always returns the same result as 100.
Cell references (including named cells and ranges)
Example −
=A1=C12 Compares cell A1 with cell C12. If the cells are identical, the formula returns TRUE; otherwise, it returns FALSE.
Worksheet functions (such as SUMor AVERAGE)
Example −
=SUM(A1:A12) Adds the values in the range A1:A12.
Creating Formula
For creating a formula you need to type in the Formula Bar. Formula begins with '=' sign. When building formulas manually, you can either type in the cell addresses or you can point to them in the worksheet. Using the Pointing method to supply the cell addresses for formulas is often easier and more powerful method of formula building. When you are using built-in functions, you click the cell or drag through the cell range that you want to use when defining the function’s arguments in the Function Arguments dialog box. See the below screen shot.
As soon as you complete a formula entry, Excel calculates the result, which is then displayed inside the cell within the worksheet (the contents of the formula, however, continue to be visible on the Formula bar anytime the cell is active). If you make an error in the formula that prevents Excel from being able to calculate the formula at all, Excel displays an Alert dialog box suggesting how to fix the problem.