Vous êtes sur la page 1sur 15

Calculating with Advanced Formulas

Michelle Loker 3/24/2010

Excel 2007

Table of Contents
Absolute Cell Reference .......................................................................................................................................... 1 Naming a Cell or Range of Cells............................................................................................................................... 1 Using Names in Formulas .................................................................................................................................... 2 Finding a Named Cell or Range ........................................................................................................................... 2 Editing a Named Cell or Range ............................................................................................................................ 2 Formula Structure ................................................................................................................................................... 3 How to write a formula using a function ............................................................................................................ 3 Individual Arguments ...................................................................................................................................... 3 Through Arguments ........................................................................................................................................ 3 Calculating Across Worksheets ............................................................................................................................... 3 Referencing Multiple Worksheets ...................................................................................................................... 3 Sheet Separators ................................................................................................................................................. 4 3-D Cell References ............................................................................................................................................. 4 Using formulas for sheets in consecutive order: ............................................................................................ 4 Using formulas for specific sheets .................................................................................................................. 5 Functions ................................................................................................................................................................. 5 Function Categories ............................................................................................................................................ 6 Calculating with Date and Time Function ........................................................................................................... 7 Today Function ................................................................................................................................................ 7 Now Function .................................................................................................................................................. 7 Calculating with Financial Functions ................................................................................................................... 7 PMT Function .................................................................................................................................................. 7 Calculating with Math and Trig Functions .......................................................................................................... 8 Sum Function................................................................................................................................................... 8 SumIf Function ................................................................................................................................................ 9 Calculating with Statistical Functions................................................................................................................ 10 Average ......................................................................................................................................................... 10 Count ............................................................................................................................................................. 10 CountA........................................................................................................................................................... 10 Calculating with Look-up and Reference Functions .......................................................................................... 11 Using the Vlookup function:.......................................................................................................................... 11 Calculating with Logical Functions .................................................................................................................... 13

Absolute Cell Reference


Absolute cell references can be very important when copying and pasting formulas. By default, when you copy and paste a formula it will use a relative cell reference. When the formula is pasted it will automatically change to a cell range, within the range of where the formula is being pasted. In some cases that is fine, but not when you want to reference the same cell range in the original formula. Absolute cell references need to be used if you want to reference the same cell in a copied formula. To reference an absolute cell put a dollar sign ($) in front of the reference that should be absolute. Cell references can be a mix of absolute and relative. Example of cell reference combinations, using cell C2: 1. $C$2 This is an example of an absolute cell reference that would always reference the value in cell C2. 2. $C2 This is an example using absolute and relative cell references. This cell reference would always reference column C, but the cell row would change. 3. C$2 This is an example using absolute and relative cell references. This cell reference would always reference row 2, but the column would change. 4. C2 This is an example of a relative cell reference that would change when the formula is copied. The cells would change in reference to where the formula is pasted. Note: The F4 key can be used to toggle between the cell reference options, or the dollar sign can be typed in front of the cells that should be absolute cell references. To use the F4 option, click in the formula next to the cell reference and push the F4 key to toggle through the above cell reference options.

Naming a Cell or Range of Cells

A named cell or range of cells can be used in formula references. Naming a cell or range of cells is a good time saver when writing formulas that are calculating between multiple sheets. Named cells or ranges can also be used in place of absolute cell references. 1. Select the cell or range of cells to be named 2. To the left of the formula bar is the name box, as shown in the picture to the right. By default, the name box will reference a cell that is selected. 3. Click in the name box 4. Type in a name for the selected cell or range of cells 5. Press the enter key

Page 1

Note: If a cell or range of cells has been named, the cell or range will need to be selected for the name to appear in the name box.

Using Names in Formulas


Names can be used in formulas by referencing the name instead of the cell reference. For example: I want to use a formula that figures a discount of 5%. Cell B4 has the value of 5%. I have named the cell Five. If I wanted to multiple a cell by the value in B4 (5%), I can simply reference the cell name no matter where I am in the workbook. Example of formula with cell name: = G8*Five, this would take the value in cell G8 and multiply it by the cell named Five, which is 5%. Note: When using more advanced formulas it is much easier to reference a named cell or range of cells than having to select a whole table.

Finding a Named Cell or Range


By using the name box it is easy to find a named cell or range of cells. 1. Click the drop-down arrow next to the name box Note: The name box will reference the cell that is currently selected. 2. The drop-down menu will show a list of named cells or ranges 3. Select the name. The cursor will select that cell or range of cells

Editing a Named Cell or Range


A named cell or range of cells can be changed by using the name manager. 1. 2. 3. 4. Select the formulas tab Under the defined names group, select the name manager button Select the name to be changed Click the edit button to change the name or cell range Note: A new named range can also be created by using the Newbutton in the name manager window. The filter button can be used to search specific areas for defined names. 5. Click close when finished with the name manager dialog box

Page 2

Formula Structure
To write complex formulas you will need to know basic formula structure. There are multiple ways to write formulas. Choose the best one that fits your needs for each scenario. Formulas are made up of three basic parts, the equals sign, a function or operator, and arguments. There are two main ways to write Excel formulas, with an operator or with a function. Functions can be used as a short cut to create commonly used formulas. Lastly are the arguments. Arguments are the numbers or cell references that will be used to figure a formula. Example using operator: = B1+B2+B3+B4+B5+B6+B7. The operator in this formula is the + sign. Example using function: =SUM(B1:B7). The function in this formula is SUM (which is for adding values). Formulas using functions have a different format than formulas using operators. Formulas that use function also start with an equals sign, but instead of a mixture of arguments and operators, the function is entered right after the equal sign with the arguments following in parentheses.

How to write a formula using a function


Individual Arguments Individual arguments can be used to reference specific cells within a spreadsheet. Commas can be used to separate individual arguments. Example of individual cell arguments = Function (Argument1, Argument 3). This example would only use the two specific arguments referenced. Through Arguments A colon can be used to reference arguments that are in consecutive order. Example of consecutive cell arguments = Function(Argument 1:Argument 3). This example would use arguments 1 through 3.

Calculating Across Worksheets


Calculating across worksheets will allow you to pull values from multiple worksheets to create a desired formula. When calculating across worksheets you will need to reference sheet names. The symbol to reference a sheet is an exclamation point (!). The exclamation point will need to be added to the end of the sheet name.

Referencing Multiple Worksheets


When referencing a different sheet than the one the formula will appear on, the formula will need to include an exclamation point after the sheet name. For example I have a worksheet with the name

Page 3

Library, to reference that sheet name I would type Library! within the parenthesis of the argument area. The cell reference will follow the sheet name.

Sheet Separators
If you will be referencing sheets that are in a consecutive row, use the symbol for through, which is a colon (:). If you will be referencing only specific sheets use a comma(,) between the sheet names. For example, I have a workbook that has a separate expense worksheet for each department. Each worksheet is named by department (Library, IT, Reeve). I want to keep a summary sheet of the total expanses for all departments. I added a separate sheet called Totals, for the total of all department expanses. I will need to calculate across worksheets to determine those totals. There are multiple ways this can be done.

3-D Cell References


Three-dimensional cell references are used when referencing the same cell across multiple worksheets. An example of a 3-dimentional reference is shown below. Using formulas for sheets in consecutive order: The example below shows how to create a formula with consecutive worksheets. Example formula to calculate between consecutive worksheets: =SUM(Library:Reeve!B9) Example typing out a formula using a function: 1. Click in the cell where the formula will be entered 2. Type an equal sign 3. Type in the function to be used. In the example to the right, the SUM function was typed. 4. Type a left parenthesis 5. Click on the first sheet that should be added, by using the sheet tabs at the bottom of the workbook. You can reference the formula bar to see that the formula is being built. 6. Select the cell(s) that should be calculated in the formula. In the example below, cell B9 was selected. Hold down the shift key, and then select the last worksheet that should be included in the formula.

Page 4

Note: All worksheets between the first and last sheet selected will be included in the formula. The example formula uses a colon to sum the Library worksheet through the Reeve worksheet and uses a cell reference of !B9. 7. Type a right parenthesis 8. Push the enter key for the formula results to appear Using formulas for specific sheets Specific sheets can be included in the formula by using a comma instead of the colon. 1. 2. 3. 4. 5. Click in the cell where the formula will be entered Type an equal sign Type in the function to be used. Type a left parenthesis Click on the first sheet that should be included in the formula, using the sheet tabs at the bottom of the workbook. You can reference the formula bar to see that the formula is being built. Select the cell(s) that should be calculated in the formula. Type in a comma between each cell reference Select the next sheet name Select the next cell Proceed with step 7 9 as needed When finished push the enter key to complete the formula and see the results

6. 7. 8. 9. 10. 11.

Functions
There are many functions in Excel that help with writing advanced formulas. To explore the different functions choose one of two methods. Method 1: 1. 2. 3. 4. Select the formulas tab Select the insert function button The function dialog box will open If you know the function name, type it in the search for a function box and select the Go button 5. If you do not know the function name select a category from the drop-down list. By default the most recently used functions will appear. A list of functions pertaining to the selected category will appear below, under select a function. 6. Click on a function to see a brief description

Page 5

7. Click OK to insert the selected function 8. A function arguments dialog box will appear. This is like a wizard that will make the process of writing advanced formulas much easier. Note: The argument fields in the dialog box will change depending on the function that has been selected. 9. In the example at the right when clicked in the box next to Number 1, argument help will appear towards the bottom of the dialog box. 10. Click on the red arrow pointing to the left in the first argument box, this will take you out to the worksheet so that you can select the cell(s) that should be added to the argument. 11. Notice that results will show toward the middle of the dialog box if the formula has been created successfully 12. Click the OK button once all arguments have been entered Note: Argument in bold must be filled in. Arguments that are not in bold can be filled in if needed. Notice in the example above, that the Number 1 argument box is the only one that must be filled in. Method 2: 1. Click on the function button next to the formula bar 2. Follow steps 3 12 in Method 1 above

Function Categories
There are many categories of functions in Excel. Each category has specific functions that pertain to that category. Financial: Performs common business calculations including accounting and finance. Date & Time: Performs functions involving date or time data. Math & Trig: Performs simple to complex mathematical functions. Statistical: Performs statistical analysis on ranges of data. Lookup & Reference: Finds values in a corresponding table or list and incorporates the data into the calculation. Database: Performs a function only on data that meets a criterion. Text: Allows text to be manipulated within a calculation that also contains data. Logical: Performs what-if analysis to see if a condition is true or false. Information: Performs an analysis on a range of data to determine the type of data contained in a cell.

Page 6

Calculating with Date and Time Function


Calculating with date and time can be complicated in Excel. Excel store dates and times as serial values, which can make it difficult when it comes time to perform calculations. The number tab, in the format cells dialog box can be used to choose from multiple date and time formats. Today Function The today function can be used to insert the current date. To use the today function: 1. Click in the cell where the function will be entered 2. Type =TODAY() Note: There are not any arguments for the today function. 3. Push the enter key for the formula results to appear Note: If the formula does not appear as you would like, change the formatting to a different date and time format. Now Function The now function can be used to insert the current date and time. To use the now function: 1. Click in the cell where the function will be entered 2. Type =Now() Note: There are not any arguments for the now function. 3. Push the enter key for the formula results to appear Note: If the formula does not appear as you would like, change the formatting to a different date and time format. Updating the Now Function The now function does not update automatically. The formula will only update when the worksheet is opened or printed. 1. Click in the cell that contains the function to be updated 2. Select the F9 key on the keyboard

Calculating with Financial Functions


Financial functions can be used to perform business or accounting calculations. PMT Function The payment function can be used to figure a payment based on three components: interest, number of payments, and cost of item. Each component should be inserted in its own individual cell. Figuring payment: 1. Select the cell that will contain the formula (in the example it is cell B9)

Page 7

2. 3. 4. 5. 6. 7. 8. 9.

10. 11. 12. 13. 14. 15. 16.

Open the formula dialog box by using one of the methods discussed above Use the drop-down to select the financial category Scroll down and select the PMT function The function arguments dialog box will open Click on the red arrow next to the Rate field Select the cell in the worksheet that contains the interest rate Click back on the red arrow to return to the function arguments dialog box Type in the division symbol and the rate per period (how often the payment will be made) For example, divide be 4 for quarterly, divide by 12 for monthly. Select the red arrow next to the Nper field Select the cell in the worksheet that contains the number of payments Click back on the red arrow to return to the function arguments dialog box Select the red arrow button next to the PV field Select the cell in the worksheet that contains the cost of the item Click back on the red arrow to return to the function arguments dialog box Click OK for the formula results to appear

Calculating with Math and Trig Functions


Math functions are used in most spreadsheets. The Sum function, which is the most common function in Excel is found in the Math and Trig category along with other more advanced functions. The sum function is used to add multiple cells. Sum Function Examples of sum function for individual cells:

Note: To sum individual cells, a comma can be used between each cell. Example of sum function for consecutive cells:

Page 8

Note: For a series of cells the colon is used. Sum a series of cells: 1. Click in the cell were the total should appear 2. Select the home tab, under the editing group select the AutoSum button 3. If there are numbers next to where the formula is being built, Excel will automatically select those values 4. If those are not the values that should be added, simply select the range of values you want 5. Push the enter key on the keyboard for the formula results to appear SumIf Function

The SumIf function can be used to sum certain cells based on meeting a condition within the spreadsheet. In the example sheet above there are work study students indicated by a WS and student assistant students indicated by a SA. Cell G29 will represent the total paid if they are a work study student. Cell G30 will represent the total paid if they are a student assistant. Using the SumIf function: 1. Click in the cell were the total should appear 2. Select the formula button 3. In the search for function box type SumIf 4. Click Go 5. Select SumIf 6. Click OK 7. When using the SumIf function there are three arguments that have to be filled in Note: Arguments that need to be filled in will be in bold. Range: What cells should be evaluated. (In the example the range to be evaluated is B4:B27, which includes the values for work study (WS) or student assistant (SA). Criteria: What criteria should the range chosen meet. (In the example if we are building the formula for cell G29 we would like to add the values if they are a work study student and if we are building the formula for cell G30 we would like to add the values if they are a student assistant). Sum_range: What range of cells should be added for the meet criterion. (In the example we would like to sum the range from G4:G27)

Page 9

8. Select the range, criteria and sum_range by using the red arrow to the right of the field name. Note: The red arrow next to the field name will allow you to toggle between the worksheet and the function argument dialog box. 9. Select OK when all arguments have been entered.

Calculating with Statistical Functions


Statistical functions can be used to perform analysis on a series of cells. Average The average function can be used to figure the average of a series of numbers. Using the Average function: Click in the cell were the average should appear Select the home tab Select the drop-down arrow next to the AutoSum button Select average If there are numbers next to where the formula is being built, Excel will automatically select those values 6. If those are not the values that should be averaged, simply select the range of values that should 7. Push the enter key on the keyboard for the formula results to appear Count The count function can be used to count a range of cells with numbered values. Using the Count function: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Click in the cell were the total count should appear Select the formula button In the search for function box type count Click Go Select count Click OK Select the red arrow next to the Value1 field to toggle to the spreadsheet Select the cells that should be counted Select the red arrow to toggle to the arguments dialog box Select OK when all arguments have been entered 1. 2. 3. 4. 5.

CountA The counta function can be used to count a range of cells with text values. Using the CountA function: 1. Click in the cell were the total count should appear 2. Select the formula button

Page 10

3. 4. 5. 6. 7. 8. 9.

In the search for function box type counta Click Go Select counta Select the red arrow next to the Value1 field to toggle to the spreadsheet Select the cells that should be counted Select the red arrow to toggle to the arguments dialog box Select OK when all arguments have been entered

Calculating with Look-up and Reference Functions


Lookup references can be used to create formulas that pull information from a part of one worksheet and will fill in that value in another part of a second worksheet. Two types of commonly used lookup references are, Vlookup and Hlookup: VLookup: Will look for a table in vertical format or columns. The index value being referenced must be in the first column and sorted in ascending order. HLookup: Will look for a table in horizontal format or rows. The index value being referenced must be in the first row and sorted in ascending order. The most important thing to remember when using a lookup reference is to sort the column or row containing the lookup value in ascending order Using the Vlookup function: Spreadsheet Using Vlookup Function (06-07 worksheet):

Page 11

Vlookup Source Example (Vlookup worksheet):

Using the Vlookup function: In the example 06/07 worksheet above we will be using the JobID to fill in the Title, Location, Supervisor and UDDS. All of the information needed for the 06/07 sheet is located on the Vlookup sheet above. The Vlookup sheet will be used to pull the needed information. 1. 2. 3. 4. 5. 6. Click in the cell were the formula should appear Select the formula button In the search for function box type Vlookup Select Go Select Vlookup in the list and click OK There will be three argument fields that need to be filled in for the Vlookup function Lookup_value: The value to be looked-up. Note: The value being looked up must also be in the first column of the lookup table (table_array) and sorted in ascending order. Table_array: Is the lookup table that will be used to retrieve the desired values or data. Note: If the formula will be used multiple times it is best to name the table range, by creating a named range, which is described above. Col_index_num: Is the column number in the lookup table that holds the value or data you want returned. Note: Column A = 1, Column B = 2, Column C = 3, etc. 7. Click on the red arrow next to the lookup_value field 8. Click on cell of the value to be looked up (in the example cell G3 is select from the 06-07 worksheet) 9. Click on the red arrow to toggle back to the argument dialog box 10. Click on the red arrow next to the table_array field 11. Click on the worksheet of the table that will be pulling the values and select the whole table (in the example, the Vlookup sheet was selected and the whole table was selected, the whole table

Page 12

12. 13. 14.

15.

was named Lookup, so it is not showing specific cell references. Note: To name a table use the directions provided above in the Naming a Cell or Range of Cells section of the manual). Click on the red arrow to toggle back to the arguments dialog box Click in the Column_index_num field Type in the column number of the look up table (table_array) that holds the value or data you want returned (in the example we want the value for job title, which is held in column 2 of the Vlookup table). Note: Column A = 1, Column B = 2, Column C = 3, etc. Select OK when all arguments have been entered

Calculating with Logical Functions


Logical functions are used to create what if analysis. If the formula results are true than one value will appear, but if formula results are false than another value will appear. In the example formula if a student is a work study student, which is represented by a WS on the spreadsheet, then the student wages paid will be multiplied by 40% to get the actual wage paid. The logical statement used in the formula below is If. The if function requires three arguments: Logical_test: This test if the formula is true or not. This first formula, test if the value in B4 is = WS Value_if_true: If the logical test is evaluated to true what should happen. The example formula will take the pay amount in column G and multiply it by 40%, which is the actual amount paid for a work study student. Value_if_false: If the logical test is evaluated to false what should happen. The example formula will take the value in column G and copy it to column I.

Page 13

Vous aimerez peut-être aussi