You are on page 1of 10

Overview of formulas

Formulas are equations that perform calculations on values in your worksheet. A formula starts with an equal sign (=). For
example, the following formula multiplies 2 by 3 and then adds 5 to the result.
A formula can also contain any or all of the following: functions, references, operators, and constants.

Parts of a formula
Functions: The PI() function returns the value of pi: 3.142...
References: A2 returns the value in cell A2.
Constants: Numbers or text values entered directly into a formula, such as 2.
Operators: The ^ (caret) operator raises a number to a power, and the * (asterisk) operator multiplies.
Using constants in formulas
A constant is a value that is not calculated. For example, the date 10/9/2008.An expression, or a value resulting from an
expression, is not a constant. If you use constant values in the formula instead of references to the cells (for example,
=30+70+110), the result changes only if you modify the formula yourself.
Using calculation operators in formulas
Operators specify the type of calculation that you want to perform on the elements of a formula. There is a default order in
which calculations occur, but you can change this order by using parentheses.

Types of operators
There are four different types of calculation operators: arithmetic, comparison, text concatenation, and reference.

Arithmetic operators
To perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; and produce
numeric results, use the following arithmetic operators.
+ (plus sign)



– (minus sign)



* (asterisk)



/ (forward slash)



% (percent sign)



^ (caret)




two values to produce one continuous text value "North"&"wind . When two values are compared by using these operators. Comparison operator Meaning Example = (equal sign) Equal to A1=B1 > (greater than sign) Greater than A1>B1 < (less than sign) Less than A1<B1 >= (greater than or equal to sign) Greater than or equal to A1>=B1 <= (less than or equal to sign) Less than or equal to A1<=B1 <> (not equal to sign) Not equal to A1<>B1 ILLUSTRATION: Text concatenation operator Use the ampersand (&) to join.Comparison operators You can compare two values with the following operators. the result is a logical value either TRUE or FALSE. one or more text strings to produce a single piece of text. or concatenate. Text operator Meaning Example & (ampersand) ILLUSTRATION Connects. or concatenates.

D5:D15) (space) Intersection operator. (comma) Union operator.Reference operators Combine ranges of cells for calculations with the following operators. Following the equal sign are the elements to be calculated (the operands). The equal sign tells Excel that the succeeding characters constitute a formula. which produces on reference to cells common to the two references B7:D7 C6:C8 ILLUSTRATION: RANGE UNION INTERSECTION The order in which Excel performs operations in formulas In some cases. which combines multiple references into one reference SUM(B5:B15. Calculation order Formulas calculate values in a specific order. Use of parentheses . including the two references B5:B15 . A formula in Excel always begins with an equal sign (=). the order in which calculation is performed can affect the return value of the formula. Reference operator Meaning Example : (colon) Range operator. which are separated by calculation operators. which produces one reference to all the cells between two references. so it's important to understand how the order is determined and how you can change the order to obtain desired results.

=(B4+25)/SUM(D5:F5) Using functions and nested functions in formulas Functions are predefined formulas that perform calculations by using specific values. =(5+2)*3 In the example below. and F5. text. E5. or structure. Function name. in a particular order. A tooltip with the syntax and arguments appears as you type the function. arrays. or other functions. an opening parenthesis. =5+2*3 In contrast. the arguments for the function separated by commas.To change the order of evaluation. Arguments. Argument tooltip. Arguments can be numbers. Structure of a function Structure. Arguments can also be constants. called arguments. error values such as #N/A. The structure of a function begins with an equal sign (=). For a list of available functions. formulas. click a cell and press SHIFT+F3. followed by the function name. type =ROUND( and the tooltip appears. or cell references. the following formula produces 11 because Excel calculates multiplication before addition. Functions can be used to perform simple or complex calculations. if you use parentheses to change the syntax. For example. Entering functions . Excel adds 5 and 2 together and then multiplies the result by 3 to produce 21. logical values such as TRUE or FALSE. The argument you designate must produce a valid value for that argument. The formula multiplies 2 by 3 and then adds 5 to the result. The syntax of functions The following example of the ROUND function rounding off a number in cell A10 illustrates the syntax of a function. Tooltips only appear for built-in functions. and a closing parenthesis. the parentheses around the first part of the formula force Excel to calculate B4+25 first and then divide the result by the sum of the values in cells D5. enclose in parentheses the part of the formula to be calculated first. For example.

Microsoft Office Excel displays below the cell a dynamic drop down list of valid functions. and the current result of the entire formula. For instance. Function B is a second-level function.When you create a formula that contains a function. With references. Nesting functions In certain cases. the following formula uses a nested AVERAGE function and compares the result with the value 50. you may need to use a function as one of the arguments of another function. the AVERAGE function and the SUM function are both second-level functions because they are arguments of the IF function. it must return the same type of value that the argument uses. To make it easier to create and edit formulas and minimize typing and syntax errors. Microsoft Excel displays a #VALUE! error value. A function nested within the AVERAGE function would be a third-level function. and names that match the letters or trigger. After you type an = (equal sign) and beginning letters or a display trigger. For example. You can then insert an item in the drop-down list into the formula. you can use data contained in different parts of a worksheet in one . As you enter a function into the formula. use formula autocomplete. the Insert Function dialog box displays the name of the function. If it doesn't. For example. the current result of the function. the Insert Function dialog box helps you enter worksheet functions. and so on. each of its arguments. arguments. then the nested function must return a TRUE or FALSE. if the argument returns a TRUE or FALSE value. The AVERAGE and SUM functions are nested within the IF function. Nesting level limits A formula can contain up to seven levels of nested functions. Using references in formulas A reference identifies a cell or a range of cells on a worksheet and tells Microsoft Excel where to look for the values or data you want to use in a formula. Valid returns When a nested function is used as an argument. a description of the function and each argument. When Function B is used as an argument in Function A.

Excel uses the A1 reference style. B2 refers to the cell at the intersection of column B and row 2. References to cells in other workbooks are called links or external references. enter the column letter followed by the row number. the AVERAGE worksheet function calculates the average value for the range B1:B10 on the worksheet named Marketing in the same workbook. for a total of 16. You can also refer to cells on other sheets in the same workbook. These letters and numbers are called row and column headings. The A1 reference style The default reference style By default. To refer to Use The cell in column A and row 10 A10 The range of cells in column A and rows 10 through 20 A10:A20 The range of cells in row 15 and columns B through E B15:E15 All cells in row 5 5:5 All cells in rows 5 through 10 5:10 All cells in column H H:H All cells in columns H through J H:J The range of cells in columns A through E and rows 10 through 20 A10:E20 Making a reference to another worksheet In the following example.048. To refer to a cell. For example. which refers to columns with letters (A through XFD. Reference to a range of cells on another worksheet in the same workbook Refers to the worksheet named Marketing Refers to the range of cells between B1 and B10. inclusively Separates the worksheet reference from the cell range reference .formula or use the value from one cell in several formulas. and to other workbooks.576).384 columns) and refers to rows with numbers (1 through 1.

it automatically adjusts from =A1 to =A2. the absolute reference remains the same. if you copy or fill a relative reference in cell B2 to cell B3. . If you copy or fill the formula across rows or down columns. such as $A$1. For example. If you copy or fill the formula across rows or down columns. For example. if you copy or fill an absolute reference in cell B2 to cell B3. If the position of the cell that contains the formula changes.The difference between absolute. it stays the same in both cells =$A$1. relative and mixed references Relative references A relative cell reference in a formula. Copied formula with relative reference Absolute references An absolute cell reference in a formula. such as A1. is based on the relative position of the cell that contains the formula and the cell the reference refers to. By default. always refer to a cell in a specific location. and you may need to switch them to absolute references. If the position of the cell that contains the formula changes. the absolute reference does not adjust. new formulas use relative references. By default. the reference automatically adjusts. the reference is changed. new formulas use relative references.

and so on. . VARA. AVERAGEA. and so on. 3-D references cannot be used in array formulas. preceded by a range of worksheet names. and VARPA. Microsoft Excel includes all values in cells A2 through A5 from the added sheets in the calculations. For example. 3-D references cannot be used with the intersection operator (a single space) or in formulas that use implicit intersection. MAXA. The examples use the formula =SUM(Sheet2:Sheet6!A2:A5) to add cells A2 through A5 on worksheets 2 through 6. or delete worksheets that are included in a 3-D reference. use a 3-D reference. PRODUCT. Move If you move sheets from between Sheet2 and Sheet6 to a location outside the referenced sheet range. B$1. STDEVA. If the position of the cell that contains the formula changes. insert. or delete worksheets The following examples explain what happens when you move. Excel removes their values from the calculation. the relative reference is changed. For example. Delete If you delete sheets between Sheet2 and Sheet6. STDEVPA. insert. Excel removes their values from the calculation. COUNTA. You can use 3-D references to refer to cells on other sheets. Insert or copy If you insert or copy sheets between Sheet2 and Sheet6 (the endpoints in this example). Excel uses any worksheets stored between the starting and ending names of the reference. and to create formulas by using the following functions: SUM. to define names. A 3-D reference includes the cell or range reference. Copied formula with mixed reference The 3-D reference style Conveniently referencing multiple worksheets If you want to analyze data in the same cell or range of cells on multiple worksheets within the workbook. STDEV. =SUM(Sheet2:Sheet13!B5) adds all the values contained in cell B5 on all the worksheets between and including Sheet 2 and Sheet 13. if you copy or fill a mixed reference from cell A2 to B3. and the absolute reference does not adjust. VAR. copy.Copied formula with absolute reference Mixed references A mixed reference has either an absolute column and relative row. and the absolute reference does not change. STDEVP. copy. or absolute row and relative column. AVERAGE. An absolute row reference takes the form A$1. An absolute column reference takes the form $A1. VARP. What happens when you move. MINA. MIN. the relative reference automatically adjusts. MAX. If you copy or fill the formula across rows or down columns. $B1. it adjusts from =A$1 to =B$1. COUNT.

or Excel tables. formulas.Move an endpoint If you move Sheet2 or Sheet6 to another location in the same workbook. constant values. Excel indicates the location of a cell with an "R" followed by a row number and a "C" followed by a column number. Excel adjusts the calculation to accommodate the range of sheets between them. Example Type Example with no name Example with a name Reference =SUM(C20:C30) =SUM(FirstQuarterSales) Constant =PRODUCT(A5. ranges of cells.5. In the R1C1 style. Using names in formulas You can create defined names to represent cells.B1:F20. each of which may be difficult to comprehend at first glance.8. Excel records some commands by using the R1C1 reference style. and Excel sometimes creates a defined name for you. You can turn the R1C1 reference style on or off by setting or clearing the R1C1 reference style check box under Working with formulas in the Formulas category of the Excel Options under the Office button. constant. or table. . references. range of cells. not A1 style. Reference Meaning R[-2]C A relative reference to the cell two rows up and in the same column R[2]C[2] A relative reference to the cell two rows down and two columns to the right R2C2 An absolute reference to the cell in the second row and in the second column R[-1] A relative reference to the entire row above the active cell R An absolute reference to the current row When you record a macro. formula.FALSE). For example. or constant value. A name is a meaningful shorthand that makes it easier to understand the purpose of a cell reference. if you record a command such as clicking the AutoSum button to insert a formula that adds a range of cells. formula. —G5) =SUM(Inventory_Level. The R1C1 reference style is useful for computing row and column positions in macros.3) =PRODUCT(Price. Excel adjusts the calculation to accommodate the new range of sheets between them.—Order_Amt) Table C4:G36 =TopSales06 Types of names There are several types of names you can create and use.WASalesTax) Formula =SUM(VLOOKUP(A1. such as when you set a print area. The R1C1 reference style Office Button >Excel Options>Formulas>R1C1 reference style You can also use a reference style where both the rows and the columns on the worksheet are numbered. The following information shows common examples of names and how they can improve clarity and understanding. Defined name A name that represents a cell. Excel records the formula by using R1C1 style. Delete an endpoint If you delete Sheet2 or Sheet6. You can create your own defined name.

For more information on Excel tables. . You can enter a name by: Typing Typing the name. as an argument to a formula. each time you insert an Excel table. and so on. Create a name from selection You can conveniently create names from existing row and column labels by using a selection of cells in the worksheet. which is a collection of data about a particular subject that is stored in records (rows) and fields (columns). Selecting from the Use in Formula command Select a defined name from a list available from the Use in Formula command in the Defined Names group on the Formula tab. for example. Creating and entering names You create a name by using the: Name box on the formula bar This is best used for creating a workbook level name for a selected range. Using Formula AutoComplete Use the Formula AutoComplete drop-down list. see Using structured references with Excel tables.Table name A name for an Excel table. Excel creates a default Excel table name of "Table1". "Table2". but you can change the name to make it more meaningful. where valid names are automatically listed for you.