This Document is Deprecated and is therefore no longer maintained or updated. Some of the information may be out of date.

 Excel XP/2000: Formulas and Functions


 Introduction

This handout is not the typical ITS document. While most of us have become accustomed to a nice linear document that goes along with the in-class training, this document diverges a wee bit from the norm. It would not be practical to list the 200+ functions of Excel. It would also be difficult to explain every option available when building a formula. What this document intends to do is give the user a good sense of how Excel thinks behind the scenes, and some direction in using the major features and operators that make Excel productive. If you aren't in the Formulas and Functions class at present, we at ITS encourage you to enroll in this class. Nevertheless, please use this document as a reference tool in your Excel development.

 Entering Formulas

To enter a formula in a worksheet cell, you will first type an equal sign (=) followed by elements that may include values, operators, cell references, names or functions. Then press Enter or click the Check button on the Formula Bar. Excel displays the result of the calculation on the cell and the entered formula on the Formula Bar . To switch between displaying the results or the formulas on the cells of a worksheet, press Ctrl . This is useful for checking your formulas, because Excel will produce a result as long as your formula is free of syntax errors. It's up to you to make sure that you don't have the right answer to the wrong formula.

 Operators

An operator is a symbol that performs an operation, such as a plus sign (+). The arithmetic operators for performing standard mathematical operations are: + for addition, - for subtraction, * for multiplication, / for division, ^ for exponentiation, and ( ) for grouping terms.

Formula

Result

=10+6/2

13

=(10+6)/2

8

=1-3^2

-8

=(1-3)^2

4

=1+-3^2

10

=(1+-3)^2

4

=20%

0.2

=100*20%

20

 Order of Operations (Do You Remember 6th Grade Math?)

When a formula contains several operators, there is a predetermined order in which they will be performed:

( ) Parentheses
^Exponents
* or / Multiplication or Division
+ or - Addition or Subtraction

(Forgetful? This phrase will help you remember: P lease E xcuse M y D ear A unt S ally).

In addition to the standard math operators, Excel has % which divides a value by 100. Like the minus sign used to negate values, % takes precedence over the standard operators.

 Operations on Dates & Times

Since Excel treats dates and times as numbers, they can be math operands. For example, subtract two dates to find the number of days in between.

Formula>

Result

="6/8/96"-"5/27/96"

12

="12:30 pm"-"9:00"

3:30

Although Excel records dates and times as serial date values you don?t have to enter them that way. You can manipulate dates and times in your worksheet formulas just as you manipulate other types of values. You enter date values in formats that Excel automatically applies. To enter date values in this way, type the date in one of the following formats: d/m/yy, d-mmm-yy, d-mmm, mmm-yy . You can also enter 4-digit years for any of these formats. If your entry doesn?t match any of the built-in date or time formats, Excel picks the format that?s most similar to your entry.

You can also enter times in a time format. Select a cell and type the time in one of the following forms: h:mm AM/PM, h:mm:ss AM/PM, h:mm, h:mm:ss , or the combined date and time format, m/d/yy h:mm . Notice you must separate the hours, minutes, and seconds of the time entries by colons. If you don?t include the AM, PM, A, or P with the time, Excel uses the 24-hour (military) time convention. In other words, Excel always assumes that the entry 3:00 means 3:00 AM, unless you specifically enter PM .

 Entering a Series of Dates in Excel XP

You can create an evenly spaced series of dates in a row or column in several ways, but the job is especially easy when you use the Fill handle. Suppose you want to create a series of dates in row 1. The series begins with March 1, 2002, and the dates must be exactly one month apart. If you enter 3/1/2002 in cell A1 and drag the fill handle to the right, Excel extends the series of dates incrementally by days. After you drag, Excel displays a smart tag adjacent to the selection. Click the smart tag to display the smart tag action menu, which displays a number of Autofill options; select Fill Months to convert the already-extended day series in to a month series.

If you drag the Fill handle by right-clicking it, a shortcut menu that is similar to the smart tag action menu appears. You can use this shortcut menu to select a fill command before performing any fill action. If what you want to do isn?t represented on the menu, click the Series command at the bottom of the shortcut menu to display the Fill Series dialog box. You can use the Series command to tend a series of dates with a bit more flexibility than using the Fill handle. To use this approach, type the starting date, select the range of cells you want to fill (including the starting date), and choose Edit, Fill, Series to display the Fill Series dialog box.

 Text & Logical Operations

You can also perform logical and text operations. The & operator connects two values to produce one text value. Comparison operators, which include =, <, >, >=, <=, and <>, compare two values and return the logical value TRUE or FALSE .

Formula

Result

=123&456

123456

="Route"&66

Route66

="Net"&" "&"Sales"

Net Sales

=6=5

FALSE

=6>=5

TRUE

 Cell References

In the long run, it will be more beneficial for you to use cell references instead of values as operands in formulas. That way if you change the value in a cell referenced by a formula, the calculated result updates automatically. To enter a cell reference in a formula, type it in directly or point and click on the cell, and Excel will fill in the cell reference. In this example, the formula in cell D2 multiplies the value in cell B2 by the value in cell C2. If you change the unit price for fine lamps to $50.00, then the total will automatically change to $1,000.00.

document image - no alt tag available. sorry

In formulas, you can use references to cells on other worksheets in the workbook, or even cells in other workbooks. At the point in the formula where you want to enter the cell reference, switch to that worksheet by clicking the worksheet tab, then click the cell and continue with formula. Caution : Do not click back to your original sheet to continue your formula. You must put another operand in your formula before you switch worksheets or finish your formula by hitting Enter . If you switch worksheets without the operator or hitting enter, Excel will not give you an error message. It will use the cell on the "switched to" worksheet no matter the value it finds there. So be careful and check your work until you become comfortable with the feature. This is also how one links cells in a workbook.

 Relative References

By default, Excel uses relative references. An example of this is below. To compute the totals for leather chairs and hardwood desks, you can copy the formula in cell D2 to cells D3 and D4. Use the Copy and Paste buttons on the Standard toolbar, or drag on the AutoFill handle of cell D2. You will see that the cell references will automatically adjust for the new location. For example, the formula in cell D3 will be =B3*C3, correctly reflecting the total for leather chairs. This automatic adjustment applies when you copy or move formulas with relative cell references.

document image - no alt tag available. sorry

For further clarification: if you were literally copying the formula in D2 down the worksheet, the formula in each of the cells D3 and D4 would B2*C2. But again, relative references make the formula in D2 analogous to "multiply the 2 cells to the left of me together and return the value here." So, when you copy this formula down to D3 and D4, you get what you hoped for.

 Absolute References

If you need to copy a cell reference exactly as it appears in the original formula, then you must use absolute cell references. An absolute cell reference has a $ sign preceding the column letter and row number. In this example, we anchor cell C15 as absolute so that no matter where we fill or copy D6's formula, C15 will remain anchored.

document image - no alt tag available. sorry

 Mixed References

You can also use mixed references, such as $A1 or A$1. When you copy a formula with a mixed cell reference, the column or row (whichever one does not have a $ sign) automatically adjusts for the new location while leaving the other part of the reference unchanged. As shown in the example, before copying the formula for January totals to calculate the February totals, first make the reference to column B absolute so that the correct unit price multiplies the February order quantity: your formula for D3 would be $B3*E3. Copy this formula to F3, fill down, and you are good to go.

document image - no alt tag available. sorry

 Names

If you named a cell or a range of cells, you can use the name in formulas to refer to values in the range. To enter a name in a formula, either type it in, or select one by going to Insert / Name/ Paste and choosing the appropriate name.

document image - no alt tag available. sorry

In this example, the range B2:E2 is named Sales and the range B3:E3 is named Expenses. The formula for profit for each quarter is =Sales-Expenses. Excel actually uses the values for the particular column. You can refer to the intersection of two ranges using each range's name separated by a space. In the above example, the range B2:B4 is named January. The formula =(January Sales) results in 67,810.68.

 Functions

Excel has lots of built-in functions that perform many different types of calculations. Excel functions are used in formulas and have the format: name(arguments) . A function can be the only element in a formula or part of a larger formula. Arguments can be numbers, text, cell references, range names or even formulas containing functions.

 AutoSum

The AutoSum button on the Standard toolbar is a shortcut for creating a formula that totals values in a range of cells using the Excel SUM function.

document image - no alt tag available. sorry

For example, look at the Blue Sky Airline Sales Report. To compute total January sales in cell C9: click in cell C9, then click the AutoSum button (note that Excel gave the correct sum range, C5:C8), and then press Enter or click the Check button on the formula bar. To total sales for each month all at once, select the range C9:E9 before clicking the AutoSum button. To compute monthly totals in row 9, regional totals in column F, and the grand total in cell F9, select the range C5:F9 before clicking the AutoSum button.

document image - no alt tag available. sorry

In proposing a sum range, Excel assumes that you are adding values down a column or across a row. If the proposed range is incorrect, just select the right range by clicking and dragging and then press Enter . The formula =SUM(C5,D8,E7) adds 10111, 21500, and 16900 while the formula =SUM(C5:E5,C7:E7) totals the north and east region totals.

 Using the AutoSum Button in Excel XP

The latest addition to the functionality of the AutoSum button is the menu that appears when you click the arrow next to the button. You can enter the Average, Count, Max, or Min function almost as easily as you can enter the Sum function?all it takes is an extra click to select the function you want from the menu. Plus, the More Functions command opens the Insert Function dialog box, where you can access any Excel function.

 Paste Function

To create a formula that begins with an Excel function, select Function... from the Insert menu or click the Paste Function button (below) on the Standard toolbar.

document image - no alt tag available. sorry

Excel inserts an = sign to begin the formula and then brings up the Paste Function dialog box. To insert a function elsewhere in the formula, select Function... from the Insert menu or click the Paste Function button on the Standard toolbar or the Formula Bar .

In Step 1 of the Paste Function , select the function by clicking on its name. If you do not know the name of the function that you need, select the Function Category that it falls under to filter the Function Name list. Every time you select a function name, a description of the function and its arguments appears. For more information on the function you selected, click the Help button on the Paste Function dialog box. This brings up the on-line help topic window for that function.

Once you've selected the function, click the OK button to move on to Step 2. In this final step, you fill in the required arguments in the edit box(es) provided and click OK when you're done. For the arguments, you can type values, select cell ranges, or select a name you previously defined. You can also enter a formula (without starting with an = sign) as an argument. If you want to enter a function in the argument (this is called a nested function), click the drop down menu where the Name Box usually is and select More Functions . You will need to complete the steps of the Paste Function for the nested function before completing the original function. To the right is an example of the second step in the Paste Function tool.

 Using the Insert Function in Excel XP

For those of you using Excel XP, the Paste Function is now called the Insert Function . The Insert Function works very much the same as the Paste Function. When you want to use a built-in function, click the Insert Function button?the fx button located in the formula bar. (You can also choose Insert, Function from the menu bar.) When you do so, the Insert Function dialog box appears and it operates in the same manner as the Excel 2000 version.

 More Examples

The formula that computes average January sales for Blue Sky Airlines is =AVERAGE(C5:C8) . If the range C5:C8 were named January, then the formula =AVERAGE(January) produces the same result.Here are additional examples:

Function

Result

Description

=COUNT(C5:E8)

12

counts the numbers

=MAX(C5:E8)

24050

finds the maximum number

=MIN(C5:E8)

10111

finds the minimum number

=MAX(C5:E8)*.10

2405

finds 10% of 24050

=MAX(C5:E8)-MIN(C5:E8)

13939

subtracts 10111 from 24050

=IF(C5>20000,1,0)

0

returns 1 if C5>20000, returns 0 otherwise

=COUNTIF(January,">20000")

1

counts the number of regions whose sales exceed 20000 in January

SQRT(4)

2

finds the square root of 4

=SQRT(ABS(-4))

2

nested function, finds the square root of the absolute value of -4

 

 Copying Formulas and Pasting Only The Resulting Values

Normally when you copy a cell that contains a formula, the formula is pasted as well, which is handy. But if you want to copy only the results, without the formula, choose Edit, Paste Special . The Paste Special dialog box appears. Among many other things, you can choose Paste Special to extract the results of formulas. To transfer only the resulting values of formulas, select the Values option.

In Excel XP you can bypass this step by using the Office Clipboard on the Task Pane . First, go to Edit, Office Clipboard to activate the Office Clipboard. Then click and drag through the results you wish to paste. The values will automatically be placed on the Office Clipboard. To paste only these values, go to your desired cell and then simply click the values on the Task Pane. You can paste these values as many times as you like as long as they are still on the Office Clipboard.

 Correcting Errors

If you tried to enter a formula that contains an error, Excel will give you an error message. Click OK on the error message's dialog box. Then either edit the formula on the Formula Bar to correct the formula, or click the Cancel button to clear it. Common sources of error are parentheses that don't match or missing arguments for functions.

A formula that is free of syntax errors may result in an error value. Here are some error values you might get:

######

Not really an error. The result is too long to fit in the cell, just make the column wider.

#DIV/0!

You're trying to divide by zero.

  • Correct the divisor.

  • If the divisor is a cell reference, check that it is not empty.

#NAME?

There's a name in the formula Excel doesn't recognize.

  • If you used a name you defined, check its spelling. You can avoid this error by selecting a name in the Name Box instead of typing it in.

  • If you typed in a function, check its spelling or verify that such a function exists.

  • If you're performing operations on text, enclose it in double quotation marks.

#REF!

A cell reference is not valid. This happens if you deleted cells referred to in the formula or pasted moved cells on cells referred to in the formula. You will need to reenter the formula.

#VALUE!

The formula uses a wrong type of operand or argument. Check to see that you're not performing math operations on labels or that arguments of functions that need to be numeric are not referring to cells containing labels.

Copyright 2002-2007 The University of North Carolina at Chapel Hill.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 United States License.

Post a Comment

This form is for document feedback. If you need technical assistance, and are affiliated with UNC-Chapel Hill, please Submit a Help Request
Optional
Optional
So that we may contact you.
Do not fill out this form, this is a spam trap.
Top
University of North Carolina - Chapel Hill