Excel
Excel
Excel
Getting Started with Excel...................................................................................................1 Opening Excel .................................................................................................................1 Creating a Workbook.......................................................................................................2 Creating a Workbook: Menu Option...........................................................................2 Creating a Workbook: Toolbar Option........................................................................3 Entering Text ..................................................................................................................3 Entering Numbers ..........................................................................................................3 Entering Numbers as Text...........................................................................................3 Entering Dates or Times..................................................................................................4 Entering a Date or Time Manually..............................................................................4 Entering the Current Date or Time Automatically......................................................4 Saving Your Work...........................................................................................................4 Saving for the First Time.............................................................................................4 Saving Subsequent Times............................................................................................5 Worksheet Terms.................................................................................................................5 Editing Cell Contents...........................................................................................................7 Moving Information.........................................................................................................7 Drag and Drop vs. Cut and Paste.................................................................................7 Moving Information: Drag and Drop ..........................................................................7 Moving Information: Cut and Paste ............................................................................8 Copying Formulas............................................................................................................8 Copy and Paste ............................................................................................................9 Using the Fill Command................................................................................................10 Calculating with Functions................................................................................................10 Working with Functions................................................................................................10 Writing Functions with the Insert Function Dialog Box...........................................10 About the Function Arguments Dialog Box..............................................................13 Writing Formulas and Functions with the Point Method...............................................13 Adding Cells Together...............................................................................................13 Adding a Range of Cells with the SUM Function: Option 1.....................................13 Adding a Range of Cells with the SUM Function: Option 2.....................................14 Working with Rows and Columns.....................................................................................14 Adjusting Row Height and Column Width....................................................................14 Adjusting Row Height: Menu Option........................................................................14 Adjusting Row Height: Mouse Option......................................................................15 Adjusting Column Width: Menu Option...................................................................15 Adjusting Column Width: Mouse Option..................................................................15 Using AutoFit to Adjust Rows and Columns................................................................16 Using AutoFit to Adjust Row Height: Mouse Option...............................................16 Using AutoFit to Adjust Row Height: Menu Option.................................................16 Using AutoFit to Adjust Column Width: Mouse Option...........................................16 Using AutoFit to Adjust Column Width: Menu Option............................................16 Adding and Removing Rows and Columns...................................................................16 Adding Rows.............................................................................................................17 Adding Columns........................................................................................................17 Deleting Rows............................................................................................................17
Deleting Columns......................................................................................................17 Importing an External Data File........................................................................................18 Working with Comments...................................................................................................20 The Reviewing Toolbar.................................................................................................21 Adding Comments.........................................................................................................21 Adding Comments: Menu Option..............................................................................21 Adding Comments: Mouse Menu..............................................................................21 Adding Comments: Toolbar Option..........................................................................22 Editing Comments.........................................................................................................22 Editing Comments: Menu Option..............................................................................22 Editing Comments: Mouse Option............................................................................22 Editing Comments: Toolbar Option...........................................................................22 Displaying/Hiding Comments.......................................................................................23 Displaying/Hiding Comments: Single Cell...............................................................23 Displaying/Hiding Comments: Toolbar Option.........................................................23 Displaying/Hiding Comments: All Cells...................................................................23 Deleting Comments.......................................................................................................23 Removing Comments from a Single Cell: Menu Option...........................................23 Removing Comments from a Single Cell: Mouse Option.........................................23 Removing Comments from a Single Cell: Toolbar Option.......................................24 Removing Comments from All Cells: Menu Option.................................................24 Printing Comments........................................................................................................24 Using the Fill Command....................................................................................................25 Filling Cells....................................................................................................................25 Filling Cells: Menu Option........................................................................................25 Filling Cells: Mouse Option.......................................................................................26 Creating Custom Fills ...................................................................................................26 Creating a Custom Fill ..............................................................................................26 Importing Custom Fills .............................................................................................28 Using a Custom Fill ..................................................................................................29 Using the Paste Special Feature.........................................................................................29 Example: To copy and paste only the results of a formula:.......................................30 Using the Find and Replace Features.................................................................................30 Using the Find Feature...................................................................................................30 Finding Information...................................................................................................31 Searching Options......................................................................................................31 Using the Replace Feature.............................................................................................32 Replacing Information...............................................................................................32 Establishing Criteria...........................................................................................................33 Types of Conditions.......................................................................................................33 Alphabetic Conditions...............................................................................................33 Numeric Conditions...................................................................................................33 Date Conditions.........................................................................................................34 Defining a Single Criterion............................................................................................34 Format........................................................................................................................34 Example.....................................................................................................................34
Defining Multiple Criteria.............................................................................................34 AND Match Two Conditions................................................................................35 Format........................................................................................................................35 Example.....................................................................................................................35 BETWEEN ... Match Two Conditions......................................................................35 Format........................................................................................................................35 Example.....................................................................................................................35 OR ... Match Either of Two Conditions (Same Field)...............................................35 Format........................................................................................................................35 Example.....................................................................................................................35 OR Match Either of Two Conditions (Different Fields).......................................35 Format........................................................................................................................36 Example.....................................................................................................................36 Filtering Your Database.....................................................................................................36 Cautions for Working with Filters.................................................................................36 Using AutoFilter............................................................................................................36 Activating AutoFilter ................................................................................................37 Running AutoFilter....................................................................................................37 Using Custom Filter...................................................................................................37 Turning Off the AutoFilter.........................................................................................38 Using Advanced Filter...................................................................................................38 Before You Start........................................................................................................38 Running an Advanced Filter......................................................................................39 Turning Off Advanced Filter.....................................................................................40 Copying an Advanced Filter to a Second Location...................................................40 Using the Sort Command...................................................................................................41 Analyzing Your Database with Functions.........................................................................42 Defining the Syntax of Database Functions ..................................................................42 =function(database,field,criteria)...............................................................................42 Performing Database Functions.....................................................................................43 Examples of Database Functions ..................................................................................44 Working with Range Names..............................................................................................47 Naming Ranges: Tips.....................................................................................................48 Creating Range Names..................................................................................................48 Creating Range Names: Dialog Box Option .............................................................48 Creating Range Names: Name Box Option ..............................................................48 Creating Range Names: Multiple Range Names.......................................................49 Adjusting Range References..........................................................................................49 Deleting Range Names..................................................................................................49 Using Range Names in Formulas/Functions..................................................................50 Using Range Names in Functions: List Option.........................................................50 Using Range Names in Functions: Typing Option....................................................50 Using Range Names: Additional Options......................................................................51 Calculating Subtotals in Databases....................................................................................51 Adding Subtotals............................................................................................................51 Adjusting Views with Subtotals.....................................................................................52
Removing Subtotals.......................................................................................................53 Re-sorting the Data........................................................................................................53 Organizing Worksheets......................................................................................................53 Renaming Worksheet Tabs ...........................................................................................53 Renaming Worksheet Tabs: Menu Option................................................................53 Renaming Worksheet Tabs: Mouse Option...............................................................54 Changing Worksheet Tab Colors ..................................................................................54 Changing Worksheet Tab Colors: Menu Option.......................................................54 Changing Worksheet Tab Colors: Mouse Option......................................................54 Inserting Worksheets.....................................................................................................55 Inserting Worksheets: Menu Option..........................................................................55 Inserting Worksheets: Mouse Option........................................................................55 Moving Worksheets.......................................................................................................56 Moving Worksheets: Same Workbook, Menu Option .............................................56 Moving Worksheets: Same Workbook, Drag and Drop Option................................56 Moving Worksheets: Different Workbook................................................................57 Copying Worksheets......................................................................................................57 Copying Worksheets: Same Workbook.....................................................................57 Copying Worksheets: Different Workbook...............................................................58 Deleting Worksheets......................................................................................................58 Deleting Worksheets: Menu Option .........................................................................58 Deleting Worksheets: Mouse Option.........................................................................58 Working with Groups of Worksheets................................................................................59 Grouping Worksheets....................................................................................................59 Ungrouping Worksheets................................................................................................59 Ungrouping Worksheets: All Sheets .........................................................................59 Ungrouping Worksheets: Individual Sheets .............................................................60 Formatting Worksheet Groups.......................................................................................60 Printing Worksheet Groups............................................................................................60 Working with Range Names..............................................................................................61 Naming Ranges: Tips.....................................................................................................61 Creating Range Names..................................................................................................61 Creating Range Names: Dialog Box Option .............................................................61 Creating Range Names: Name Box Option ..............................................................62 Creating Range Names: Multiple Range Names.......................................................62 Adjusting Range References..........................................................................................63 Deleting Range Names..................................................................................................63 Using Range Names in Formulas/Functions..................................................................63 Using Range Names in Functions: List Option.........................................................64 Using Range Names in Functions: Typing Option....................................................64 Using Range Names: Additional Options......................................................................64 Navigating Your Large Workbook....................................................................................64 Keyboard Shortcuts........................................................................................................65 Keyboard Shortcuts from the Help Menu..................................................................65 Using the Go To Command...........................................................................................65 Using the Go To Command: Menu Option................................................................65
Using the Go To Command: Name Box Option........................................................66 Moving Between Open Workbooks...............................................................................66 Using Screen Options....................................................................................................66 Freezing the Panes ....................................................................................................66 Splitting the Screen....................................................................................................67 Performing Calculations in Your Workbook.....................................................................69 Writing Formulas for Your Workbook..........................................................................69 Writing Formulas for Multiple Worksheets...............................................................69 Writing Formulas for Other Workbook Files............................................................71 Using Range Names in Formulas..............................................................................71 Cell Reference............................................................................................................71 Range Name Reference..............................................................................................71 Calculating Your Workbook..........................................................................................71 Changing to Manual Calculation...............................................................................72 Correcting Circular References .........................................................................................74 Introduction to Troubleshooting....................................................................................74 Tracking Down Circular References.............................................................................74 Correcting Circular References......................................................................................75 Protecting Your Worksheet................................................................................................76 Protection Options.........................................................................................................76 Locking & Unlocking Cells...........................................................................................76 Locking Cells.............................................................................................................77 Unlocking Cells.........................................................................................................77 Workbook Level Protection...........................................................................................77 Protecting the Workbook...........................................................................................77 Unprotecting the Workbook......................................................................................78 Worksheet Level Protection...........................................................................................78 Protecting the Worksheet...........................................................................................78 Unprotecting the Worksheet......................................................................................80 File Level Protection......................................................................................................80 Protecting the File......................................................................................................80 Unprotecting the File ................................................................................................81 About Charting...................................................................................................................82 Charting Rules...............................................................................................................82 Bad Data Sample .......................................................................................................82 Good Data Sample ....................................................................................................83 About Charting Elements...............................................................................................83 Guidelines for Charting......................................................................................................85 General Hints.................................................................................................................85 Pie Charts.......................................................................................................................85 Bar Graphs.....................................................................................................................86 Line Graphs....................................................................................................................87 Summary........................................................................................................................88 Getting Ready to Chart......................................................................................................89 Designing Your Worksheet for Charting ......................................................................89 Recommended: Range Names.......................................................................................90
Creating a Basic Chart.......................................................................................................91 Using the Chart Wizard.................................................................................................91 Using the Chart Wizard: Selecting Your Data...........................................................91 Using the Chart Wizard: Range Names.....................................................................92 Modifying a Chart..........................................................................................................92 Changing the Chart Type...............................................................................................93 Working with Ranges / Data Series ..............................................................................93 Deleting a Data Series ...............................................................................................93 Adding a Data Series.................................................................................................93 Positioning Your Chart..................................................................................................94 Moving Your Chart ...................................................................................................94 Resizing Your Chart .................................................................................................94 Formatting Your Chart.......................................................................................................94 Selecting Chart Elements ..............................................................................................95 Adjusting Chart Colors and Patterns .............................................................................95 Adding Arrows and Text Boxes....................................................................................95 Adjusting Chart Fonts....................................................................................................96 Working with Chart Elements...........................................................................................96 Adding a Chart Title......................................................................................................96 Working with Legends ..................................................................................................97 Placing the Legend ....................................................................................................97 Working with Axes .......................................................................................................98 Scaling an Axis .........................................................................................................98 Creating Charts with a Percent Scale ............................................................................99 Creating Charts with a Percent Scale: Menu Option.................................................99 Creating Charts with a Percent Scale: Mouse Option................................................99 Adding Data Labels to Your Chart ...............................................................................99 Working with Grids ....................................................................................................100 Inserting Gridlines ..................................................................................................100 Creating Exploding Pie Charts.........................................................................................101 Creating an Exploding Pie Chart.................................................................................101 Exploding an Existing Pie Chart..................................................................................101 Changing the Chart Type ........................................................................................102 Exploding All Pie Slices..........................................................................................102 Exploding a Single Pie Slice....................................................................................102 Charting Extras................................................................................................................102 Printing Chart and Worksheet Data.............................................................................103 Printing the Data and Chart .....................................................................................103 Printing Only the Chart............................................................................................103 Copying Charts to Word..............................................................................................103 Functions: Rank...............................................................................................................104 Functions: Countif and Sumif..........................................................................................106 Countif ........................................................................................................................106 Sumif............................................................................................................................107 Functions: Concatenate....................................................................................................109 Functions: Subtotal..........................................................................................................110
Function Numbers........................................................................................................111 Using the Subtotal Function.........................................................................................111 Filtering........................................................................................................................113 Modifying the Subtotal Function.................................................................................113 Inserting Dates and Times...............................................................................................114 Inserting Dynamic Dates and Times............................................................................114 Inserting a Dynamic Date Only...............................................................................114 Inserting a Dynamic Date and Time........................................................................114 Inserting Static Dates and Times.................................................................................114 Inserting a Static Date..............................................................................................114 Inserting a Static Time.............................................................................................115 Functions in Excel............................................................................................................116 The Absolute Value.....................................................................................................118 The Ceiling of a Number ............................................................................................118 The Floor of a Number................................................................................................118 The Power of a Number...............................................................................................120 The Exponential ..........................................................................................................120 The Log10....................................................................................................................120 The Square Root..........................................................................................................121 Financial Functions .....................................................................................................121 The Future Value of an Investment.............................................................................123 The Number of Periods of an Investment....................................................................124 Investment or Loan Payment.......................................................................................124 The Amount Paid As Interest During a Period ...........................................................126 The Present Value of a Loan or an Investment ...........................................................130 The Interest Rate .........................................................................................................130 The Internal Rate of Return ........................................................................................132 The Net Present Value ................................................................................................134 Logical Function..........................................................................................................137 IF..................................................................................................................................137 Nested IF .....................................................................................................................137 VLOOKUP..................................................................................................................137 HLOOKUP..................................................................................................................140 Index............................................................................................................................142 Match...........................................................................................................................146 Creating a Pivot Table....................................................................................................148 What is a Pivot Table...................................................................................................148 PivotTable Wizard Step 3 of 3.................................................................................150 Graphing Your Report.................................................................................................153 Editing your Graph......................................................................................................154 CUSTOMIZING A PIVOT TABLE...........................................................................155 Redesigning the Pivot Table Report............................................................................155 Including an Additional Data Field..............................................................................156 Using the Page Option..............................................................................................157 Displaying Pages on Separate Worksheets..................................................................158 Grouping Your Data....................................................................................................159
Representing Your Dollar Amounts as Percentages of a Column or a Row...............160 Custom calculations for PivotTable data fields...........................................................161 Function Result......................................................................................................161 Displaying The Detail Data Behind A Summarized Amount......................................162 Sorting a Pivot Table Report........................................................................................162 Collapsing and Expanding a Pivot Table.....................................................................163 Hiding a Row or Column Item.....................................................................................164 Suppressing Subtotals..................................................................................................165 Changing Field Button Labels ....................................................................................170 Automating Excel with Macros...................................................................................171 Macro Tips...................................................................................................................171 Naming a Macro......................................................................................................171 Saving a Macro........................................................................................................172 Assigning Macros ...................................................................................................172 Recording Notes ......................................................................................................172 Accessing the Record New Macro Command ............................................................172 Accessing the Record New Macro Command: Menu Option ................................172 Accessing the Record New Macro Command: Toolbar Option..............................172 Creating & Recording a New Macro...........................................................................174 Running a Macro..........................................................................................................175 Running a Macro: Dialog Box Option.....................................................................175 Running a Macro: Keyboard Option........................................................................175 Suspending a Macro.....................................................................................................176 Deleting a Macro..........................................................................................................176 Advanced Macros........................................................................................................176
Opening Excel Creating a Workbook Entering Text Entering Numbers Entering Dates or Times Saving Your Work
Opening Excel
When Excel is opened, it opens a blank worksheet. An Excel worksheet file is called a workbook. A workbook is the Excel worksheet file in which related data and information for a specific project are stored. A workbook consists of many worksheets, or multiple layers, which are for listing and analyzing data. For more information on Excel terminology, refer to Worksheet Terms. 1. Windows: From the Start menu, select All Programs Microsoft Office Microsoft Office Excel 2003 Macintosh: Double click MACINTOSH HD, select Applications Microsoft Office 2004 Microsoft Excel
Creating a Workbook
An Excel workbook contains multiple worksheets. Worksheets can be used to group information together. A worksheet can contain data, charts, or both.
Entering Text
A cell containing text and numbers or only text cannot be used in formulas, even if numbers exist with the alphabetic characters. 1. Select the cell where you want to enter text 2. Type the alpha-numeric text that should be in the cell 3. Windows: To accept the information, press [Enter] or an [Arrow] key To force text to wrap at a specific point in a cell, press [Alt] + [Enter] Macintosh: To accept the information, press [return] or an [arrow] key To force text to wrap, in the Formatting Palette, under Alignment and Spacing, select Wrap Text
Entering Numbers
Numeric cells can be used for calculations and functions. A numeric cell may contain numbers, plus (+), minus (-), currency ($). 1. Select the cell where you want to enter numbers 2. Type the numeric information that should be in the cell HINT: To enter a fraction, type 0 and press [Space] before the fraction; otherwise, Excel will interpret the fraction as a date. 3. Windows: To accept the information, press [Enter] or an [Arrow] key Macintosh: To accept the information, press [return] or an [arrow] key NOTES: Excel automatically right-aligns values and left-aligns text. Do not include spaces or alphabetic characters in a calculation cell.
6. Windows: To force text to wrap at a specific point in a cell, press [Alt] + [Enter] Macintosh:To force text to wrap at a specific point in a cell, press [command] + [option] + [return] 7. Windows: To accept the information, press [Enter] or an [Arrow] key Macintosh: To accept the information, press [return] or an [arrow] key
NOTE: You do not need to type the file extension ".xls." The file extension will be automatically added to the filename. 4. Click SAVE The file is saved.
Worksheet Terms
Like all other areas of computer technology, Microsoft Excel worksheets have their own "language." This list of common terms is provided to serve as a reference for you as you work in Excel. Term Cell Cell Pointer Definition The intersection of a column and row. Information is stored in cells. The cell pointer is similar to Word's insertion point. It selects or marks the current cell (where the next activity is going to take place). The Excel pointer changes shape depending on location and corresponding function. For more information, refer to Pointer Shapes. The address (consisting of the column and row IDs) of a specific cell. The current cell location is displayed in the upper left corner of the worksheet. A vertical group of cells within a worksheet. A set of instructions which a calculation based on numbers entered in the cell or numbers entered in other cells (referred to by cell references). All formulas begin with the equal sign ( = ). A pre-programmed formula. The function performs the calculation based on the cells referenced in the function. All functions begin with the equal sign ( = ). A group of cells. Ranges are often referenced for formulas, printing, and designating information to be copied or cut. Ranges can be selected by dragging (also referred to as painting) over the cells. A horizontal group of cells within a worksheet. A number that can be used in an Excel calculation. 5
Function
Range
Row Value
Workbook
Worksheet A single layer or single sheet within the workbook. A worksheet can contain data, charts, or both. Instead of compiling all of your information into one worksheet, you can create several worksheets within the one workbook file. With this organization, similar information is grouped together to make it easier to locate and use. The worksheets for your workbook will vary based on its content and purpose. EXAMPLE: If you want one file containing the gradebooks for all sections you teach, each section can be on a separate sheet. NOTE: The terms worksheet and spreadsheet are often used interchangeably.
Moving Information
Often, your first approach at organization will not be the same as your final ideas. For this reason, you may want to reorganize information. Also, you may have the need for a similar formula in a second location. The Drag and Drop, Cut and Paste, and Copy and Paste options will help you do this without having to recreate the entire worksheet.
Macintosh:
The
mouse
pointer
changes
to
hand
3. Holding the mouse button, drag the cell(s) to the new location NOTE: An outline of the cell(s) you are moving will appear over the new location. As you move the cell(s), a box appears next to the pointer indicating the cell location. 4. When you reach the desired location, to drop the cell(s), release the mouse button WARNING: If information already exists at the new location, a dialog box will appear asking if you want to replace the information. To undo Drag and Drop: 1. From the Edit menu, select OR On the Standard toolbar, click UNDO Undo Drag and Drop
cell. Cut
Paste
Copying Formulas
With a relative formula, the cell references change in relation to the new location of the cell. For example, if you copied the formula from column A to B and the formula used a 8
value in cell A12, the formula would now be referring to cell B12. If you cut the formula, it would refer to the original cell, A12. With an absolute formula, in the same example, the cell reference to A12 would remain constant. A formula can have both relative and absolute components. When formulas are created, they are created as relative. By adding a dollar sign ($) before either the column or row location or both, that reference becomes absolute. When copying formulas, cell references are important to the result of the formula. If you want to copy the formula and look at cells with similar information one column over, a relative formula is the best choice. However, if you want to copy the formula and refer to the same cell (perhaps the wage rate of a student employee), you should be working with an absolute formula, not a relative formula. NOTE: Absolute references are automatically updated for column and row additions and deletions. Example =A12+B12 =SUM(A12:A16) =$A$12+$B$12 =$A12+$B12 =SUM(A$12:A$16) Description Formula with relative references Function with relative references Formula with absolute references Formula with absolute column references but relative row references Function with absolute row references but relative column references
3. Select the cell where you want the cells to be pasted 4. From the Edit menu, OR
select
Paste
On the Standard toolbar, click PASTE 5. To deselect Copy, double click outside the area just pasted or copied
Working with Functions Writing Formulas and Functions with the Point Method
Insert Function dialog box will request certain types of information. You simply select the cells where that information is located. Windows: 1. Place the cell pointer on the cell where the formula should be added 2. From the Insert menu, select Function The Insert Function dialog box appears.
3. From the Or select a category pull-down list, select the appropriate function category or All 4. From the Select a function scroll box, select the desired function HINT: A description of the selected function appears beneath the Select a function scroll box. 5. Click OK The Function Arguments dialog box appears.
6. In the text boxes, type the data to be in the function HINTS: To hide the dialog box so you can select cell ranges with the mouse rather than type them, click COLLAPSE DIALOG . To restore the dialog box, click RESTORE DIALOG . 7. Click OK 11
Macintosh: 1. Place the cell pointer on the cell where the formula should be added 2. From the Insert menu, select Function The Paste Function dialog box appears.
3. From the Function category scroll box, select the appropriate function category or All 4. From the Function name scroll box, select the desired function HINT: A description of the selected function appears beneath the Function category scroll box . 5. Click OK The Function Arguments dialog box appears.
6. In the HINTS:
text
boxes,
type
the
data
to
be
in
the
function 12
To hide the dialog box so you can select cell ranges with the mouse rather than type them, click COLLAPSE DIALOG . To restore the dialog box, click EXPAND DIALOG . 7. Click OK
1. 2. 3. 4. 5. 6. 7. 8.
Place the insertion point in the cell where the results should be displayed To start the function, press [=] Type SUM( Point and click the first cell in the range to be added Press [:] Point and click the last cell to be added Type ) Press [Enter] or [return]
Adjusting Row Height and Column Width Using AutoFit to Adjust Rows and Columns Adding and Removing Rows and Columns
1. To adjust a single row, select any cell from Windows: To adjust multiple non-contiguous rows, from each row to Macintosh: To adjust multiple non-contiguous rows, cells from each row to be adjusted 2. From the Format menu, select The Row Height dialog box appears. 3. In the Row height text box, type the desired height 4. Click OK The row height is adjusted.
the row to be adjusted press [Ctrl] + select cells be adjusted press [command] + select Row Height...
3. When the row reaches the desired height, release the mouse button The row height is adjusted.
1. Along the column ID (A, B, C, ...), point to the border right of the column to be adjusted 2. When the pointer turns into a double-arrow, click and drag HINT: For a narrower column, drag left; for a wider column, drag right. A box appears next to the pointer, indicating the current column width as you drag it.
3. When the column reaches the desired width, release the mouse button The column width is adjusted.
When working with worksheets, you will often need to make changes to the original worksheets. You will often need to delete old information or add new information. To make this task easier, you can add new rows and columns or delete existing rows and columns. The process is similar for both rows and columns.
Adding Rows
1. Select a cell below where you want to add a new row 2. From the Insert menu, A new row is added above the selected cell. select Rows
Adding Columns
1. Select a cell to the right of where you want to add a new column 2. From the Insert menu, select A new column is added left of the selected cell. Columns
Deleting Rows
WARNING: When you delete a row, everything in the row is deleted. If you do not want to delete the whole row, delete information from specific cells instead. 1. To delete a single row, select any cell from the row to be deleted Windows: To delete multiple non-contiguous rows, press [Ctrl] + select cells from each row to be deleted Macintosh: To delete multiple non-contiguous rows, press [command] + select cells from each row to be deleted 2. From the Edit menu, select Delete... The Delete dialog box appears. 3. Select Entire row 4. Click OK The row is deleted.
Deleting Columns
WARNING: When you delete a column, everything in the column is deleted. If you do not want to delete the whole column, delete information from specific cells instead. 1. To delete a single column, select any cell from the column to be deleted Windows: To delete multiple non-contiguous columns, press [Ctrl] + select cells from each column to be deleted Macintosh: To delete multiple non-contiguous columns, press [command] + select cells from each column to be deleted 2. From the Edit menu, select Delete... The Delete dialog box appears. 3. Select Entire column 17
OK
18
data
was
created.
6. Click NEXT 7. If your data is delimited, change and/or confirm the delimiters and click NEXT NOTE: The Text Import Wizard automatically selects the delimiter that it thinks is being used (usually Tab), however, if you know it to be something different you can specify a different delimiter such as, Semicolon, Comma, or Space. 8. To set the data format of each column a. In the Data preview section, select a column
19
b. In the Column data format section, select the data format HINT: All of the columns will be automatically formatted as General by the Text Import Wizard. If you are unsure about how to format the data, allow the columns to remain General. 2. Click FINISH The Import Data dialog box appears.
3. To place the data in a new worksheet, select New worksheet 4. To place the data in the existing worksheet, a. Select Existing worksheet b. Click COLLAPSE DIALOG The Import Data dialog box is collapsed. c. Select the cell where the imported data should begin d. Click RESTORE DIALOG The Import Data dialog box is restored. 5. Click Your data appears in the designated location.
or or OK
The Reviewing Toolbar Adding Comments Editing Comments Displaying/Hiding Comments Deleting Comments Printing Comments 20
Macintosh: 1. From The the View menu, Reviewing select Toolbars toolbar Reviewing appears.
Adding Comments
Adding a comment to a cell allows you place additional information within that cell. The comment, along with the username of the person who inserted the comment, appears when you point to the cell.
1. Windows: Right click the cell to which you want to add a comment select Insert Comment Macintosh: Press [control] + click the cell to which you want to add a comment select Insert Comment The Comment box appears with your username. 2. Type your comment 3. Click another cell A red triangle appears in the upper right-hand corner of the cell indicating a comment has been attached. When you place your mouse over the cell, the comment appears.
Editing Comments
Editing a comment allows you to add to or change the information you have placed within a cell as a comment.
1. Select the cell that contains the comment to be edited NOTE: On the Reviewing toolbar, the New Comment button now changes to the Edit Comment button 2. On the Reviewing toolbar, click EDIT COMMENT The Comment box appears. 3. Make the appropriate changes 4. Click another cell
Displaying/Hiding Comments
To have comments remain on the screen or disappear from the screen when your pointer is not "over" the cell, use one of the following sets of directions.
Deleting Comments
Deleting comments allow you to either remove the comment you have placed within an individual cell, or to remove all of the comments you have placed within a document.
Macintosh: Press [control] + click the cell to which you want to add a comment select Delete Comment
Printing Comments
Comments must be displayed before printing. Windows: 1. Open the worksheet that contains the comments you want to print 2. From the File menu, select Page Setup... The Page Setup dialog box appears. 3. Select the Sheet tab 4. To print all comments in a group, under Print, from the Comments pull-down list, select At end of sheet To print comments as they appear, under Print, from the Comments pull-down list, select As displayed on sheet NOTE: Only displayed comments will print for the second option. 5. Click PRINT... The Print dialog box appears. 6. Make the appropriate selections Click OK Macintosh: 1. Open the worksheet that contains the comments you want to print 2. From the File menu, select Page The Page Setup dialog box appears. 3. Select the Sheet tab Setup...
24
4. To print all comments in a group, under Print, from the Comments pull-down list, select At end of sheet To print comments as they appear, under Print, from the Comments pull-down list, select As displayed on sheet NOTE: Only displayed comments will print for the second option. 5. Click OK 6. From the File menu, select Print... The Print dialog box appears. 7. Make the appropriate selections 8. Click PRINT
Filling Cells
Filling Cells: Menu Option
This option copies (repeats) the information from one cell to another. To extend the series, refer to the Mouse Option. 1. Type the information (cell contents or formula) in the first cell of the group 2. Starting with the cell containing the contents to be copied, select the group of cells to be filled 3. From the Edit menu, select Fill Down or Right OR Windows: Press [Ctrl] + [D] or [Ctrl] + [R], respectively Macintosh: Press [control]+ [D] or [control] + [R], respectively 25
3. When your pointer changes into crosshairs, click and hold the crosshairs 4. Drag the crosshairs in the direction you want the information to be copied NOTES: You can drag the corner in any one direction either to the left, right, up, or down. You can move in only one direction at a time. 5. Release the mouse button The information is extended.
EXAMPLE:
A,
A-,
B+,
B,
B-,
...,
5. Click ADD Your new entries appear in the Custom lists scroll list. 6. Click OK Macintosh: 1. From the Excel menu, select Preferences The Preferences dialog box appears. 2. From the list on the left, select Custom Lists 3. From the Custom lists scroll box, select NEW LIST 4. In the List entries text box, type the information you want to be added in the custom fill, pressing [return] after each entry
27
EXAMPLE:
A,
A-,
B+,
B,
B-,
...,
5. Click ADD Your new entries appear in the Custom lists scroll box. 6. Click OK
28
4. Click Your
selection
appears
in
the
List
entries
OK
All except borders Column widths Formulas and number formats Values and number formats
5. Under Paste, select Values 6. Click The results of the formula are pasted into the selected cell(s).
OK
The Find feature can be helpful if you are trying to locate information not currently visible on the screen. You can search for information used in formulas, values, and notes.
Finding Information
1. From the Edit menu, select Find... OR Windows: Press [Ctrl] + [F] The Find and Replace dialog box appears. Macintosh: Press [control] + [F] The Find dialog box appears. 2. In the Find what text box, type the text or data to be found 3. OPTIONAL: Adjust the searching options 4. Click FIND NEXT The information is found and selected. NOTES: Clicking FIND NEXT again finds subsequent occurrences of the information in the document. If Excel cannot find the information you are looking for, a message to that effect will be displayed. 5. To close the dialog box, click CLOSE
Searching Options
You can limit the results of a search by using the available search options. 1. Windows: From the Find and Replace dialog box, click OPTIONS Macintosh: From the Find or Replace dialog box, select the following search options. Option Windows Format... Within Search Look In Match case Description Only: Match content when specific formatting is applied. Specify the search area (i.e., worksheet or workbook). Control the order of the search: left to right (columns) or top to bottom (rows). Limit the search to type of content: values, formulas, comments. Limit search results to cells in which the case is an exact match. EXAMPLE: Spring instead of spring. Match entire contents cell Limit search results to cells where an exact match occurs. EXAMPLE: Smith will locate Smith but not Chris Smith.
31
Replacing Information
1. OPTIONAL: If you do not want to replace the information throughout the entire document, select only those cells you want to change Windows: To select non-contiguous cells, hold down [Ctrl] + click the desired cell(s) Macintosh: To select non-contiguous cells, hold down [command] + click the desired cell(s) 2. From the Edit menu, select Replace... OR Windows: Press [Ctrl] + [H] The Find and Replace dialog box appears. Macintosh: Press [control] + [H] The Replace dialog box appears. 3. In the Find what text box, type the text or data to be found 4. In the Replace with text box, type the text or data to replace the information found 5. OPTIONAL: Adjust the searching options 6. Click FIND NEXT The first occurrence is highlighted. 7. Click REPLACE or REPLACE ALL The old information is replaced with the new. WARNING: Use the Replace All option with caution. If you do not first select specific cells to change, this option will replace the selected information throughout the entire document. 8. To close the dialog box, click CLOSE
32
Establishing Criteria
Excel needs criteria as a special feature for certain types of database functions. Criteria can be defined as the range of cells that includes the column label and a condition for that label. Criteria can be established to match a single field or multiple fields. It can be established for records to match multiple conditions (AND), match one of multiple conditions (OR), or match a range of conditions (BETWEEN). The criteria can be looking for an exact match or a match within a range of information. Using range names may make database functions easier to write.
Types of Conditions
To properly write criteria, it is important to understand how to format the condition for each criterion. There are three different formats: alphabetic conditions, numeric conditions, and date conditions. The following tables illustrate the conditions, the corresponding format, and a sample for each criteria.
Alphabetic Conditions
Condition exact match begins with greater or equal to less or equal to between* Format ="=text_string" text_string than >letter >=letter than <letter <=letter >letter <letter Sample ="=john" john >j >=j <j <=j >j <q
Numeric Conditions
Condition exact match Contains greater or equal to Format value n/a than >value >=value Sample 15 n/a >15 >=15 33
Date Conditions
Condition Format one date contains month/day/year n/a Sample 4/1/1999 n/a >4/1/1999 >=4/1/1999 <4/1/1999 <=4/1/1999
date after >month/day/year or equal to >=month/day/year date <month/day/year before <=month/day/year or equal to
range of >month/day/year<month/day/year >1/1/1999<12/31/1999 dates* *must be in separate cells within the same row
Format
Field name condition
Example
Pay Period 15
NOTE: In this example, only records where the pay period was equal to 15 would be evaluated for the database function.
Format
Field name condition field name2 condition
Example
Pay Period 15 Student Johnson
NOTE: In this example, only records where the pay period is 15 and the student name contains Johnson would be evaluated for the database function.
Format
Field name condition Field name condition
Example
Date Date >3/31/2001 <6/30/2001
NOTE: In this example, only records between March 31, 2001 and June 30, 2001 would be evaluated for the database function.
Format
Field name condition condition
Example
Pay Period 15 16
NOTE: In this example, only records where the pay period is 15 or 16 would be evaluated for the database function.
35
Format
Field name condition Field name 2 condition
Example
Pay Period Student 15 Doe
NOTES: In this example, records where the pay period is 15 or the student name contains Doe would be evaluated for the database function.
Cautions for Working with Filters Using AutoFilter Using Advanced Filter
Cell formatting affects only visible cells in the database. When printing the database, only visible cells will be printed. The Sort command will affect visible cells. When deleting data from the database, entire rows must be deleted. Most of the Edit menu commands affect entire rows, not individual fields (cells).
Using AutoFilter
36
AutoFilter works for most filtering needs, but when you have complex criteria or want to create a copy of the information, use Advanced Filter. The AutoFilter command applies pull-down lists directly to the column headings in the database. These menus are used to select the field contents, which determine what records will display.
Activating AutoFilter
1. Select a cell within the database 2. From the Data menu, select Filter AutoFilter A pull-down list will be placed next to each column heading within the selected database.
Running AutoFilter
1. Activate AutoFilter 2. From the appropriate pull-down list, select a value to use as filter criteria Rows meeting the filter criteria are now displayed. NOTE: When you use AutoFilter within a database, the row numbers will turn blue, and the results of the filter will appear in the status bar (e.g., 1 of 12 records found).
37
The
Custom
AutoFilter
dialog
box
appears.
3. From the Comparison Operator pull-down list, select a type of comparison 4. From the Corresponding pull-down list, select or type a criteria value 5. OPTIONAL: If you want multiple criteria, select either And or Or and repeat steps 3 and 4 6. Click OK NOTE: When you use AutoFilter within a database, the row numbers will turn blue.
want to place in a different location. You do not need to include all the headings of the original database and the headings that you do use can be in a different order. For example, you may have a large database of conference attendees and want to filter only the attendees' names and whether their registration fee has been paid and send that data to another sheet in your workbook. WARNING: If there is any information under the headings for the placement location, it will be deleted. As a precaution, you may want to place the placement headings on a separate sheet in the workbook file.
4. If you want the filter to replace the current database, select Filter the list, in-place NOTE: If you do not want the filter to replace the current database, refer to Copying an Advanced Filter to a Second Location. 5. In the List range text box, type the range of cells containing your database OR To minimize the Advanced Filter dialog box so you can select the range of cells manually, a. Click COLLAPSE DIALOG or b. Select the cells c. Click RESTORE DIALOG or 2. In the Criteria range field, type the range of cells or the range name containing the criteria OR To minimize the Advanced Filter dialog box so you can select the range of cells manually, a. Click COLLAPSE DIALOG or b. Select the cells 39
c. Click RESTORE DIALOG or 3. Click NOTE: With a filtered "in-place" database, the row numbers will turn blue.
OK
or
3. From the Sort by pull-down list, select the column by which you want to sort NOTE: If column IDs appear instead of column titles, under My data range has in Windows or under My list has on Macintosh, select Header row. 4. Select Ascending or Descending 5. OPTIONAL: To sort by more than one column, a. From the Then by pull-down list(s), select the column(s) by which you want to sort 41
b. Select Ascending or Descending 2. OPTIONAL: To control how to sort lists of days or months, case-sensitive data, and the sort's orientation, a. Click OPTIONS... The Sort Options appears. b. Make any necessary changes c. Click OK 3. Click OK The data is sorted.
Defining the Syntax of Database Functions Performing a Database Functions Examples of Database Functions
=function(database,field,criteria)
Database Refers to the range of cells that make up the database. This includes the row with the field names identifying the type of information in each column. Field Indicates which field will be analyzed and used in the function. The field can be referred to as the position number of the column or the field label within quotes. Criteria Criteria is the range of cells containing the conditions by which Excel will identify records to be evaluated to complete the function. Criteria must have a column label and at least one condition in the cell below its range. For more information, refer to Establishing Criteria. 42
3. From the Or select a category pull-down list, select Database 4. From the Select a function scroll list, select the appropriate function 5. Click OK The Function Arguments dialog box appears. 6. To complete the Database, Field, and Criteria text boxes, NOTE: For a definition of these terms, refer to Defining the Syntax of Database Functions. a. Select the appropriate text box b. Click COLLAPSE DIALOG c. Select the data range d. Click RESTORE DIALOG e. Repeat steps a-d until all text boxes are completed 2. To perform the function, click OK Macintosh: 1. Place the cursor in the cell where you want the results of the function to appear 43
2. On The
the
3. From the Function Category list, select Database 4. From the Function name scroll list, select the appropriate function NOTE: A description of the selected function appears below the lists. 5. Click OK The respective dialog box appears. 6. To complete the Database, Field, and Criteria text boxes, NOTE: For a definition of these terms, refer to Defining the Syntax of Database Functions. a. Select the appropriate text box b. Click COLLAPSE DIALOG c. Select the data range d. Click RESTORE DIALOG e. Repeat steps a-d until all text boxes are completed 2. To perform the function, click OK
44
DSUM: Adds the numbers in the field column of records in the database that match the criteria. Syntax Example =DSUM(database, field, criteria) To calculate the total amount that Chris was paid, type the following function: =DSUM(C3:G15,G3,C31:C32) field as cell 31 reference =DSUM(C3:G15,5,C31:C32) field as column 32 =DSUM(C3:G15,"$period",C31:C32) field as field name 280.80 C Student Chris
Results
DAVERAGE: Averages the values in the field column of records in the database that match the criteria. Syntax Example =DAVERAGE(database, field, criteria) To calculate the average number of hours that the students worked during pay period 14, type the following function: 34 =DAVERAGE(C3:G15,F3,E34:E35) field as cell reference 35 =DAVERAGE(C3:G15,4,E34:E35) field as column =DAVERAGE(C3:G15,"Hours",E34:E35) field as field name 13 hours E PP# 14
Results
DCOUNT: Counts the cells containing numbers that match the criteria in the field column 45
of records in the database. Syntax Example =DCOUNT(database, field, criteria) To count the number of pay periods in which the hours are greater than 12 and less than 10, type the following function: 44 =DCOUNT(C3:G15,C3,H44:H45) field as cell reference 45 =DCOUNT(C3:G15,1,H44:H46) field as 46 column =DCOUNT(C3:G15,"PP#",H44:H46) field as field name 8 pay periods H Hours >12 <10
Results
DCOUNTA: Counts the cells containing non-numerical data that match the criteria in the field column of records in the database. Syntax Example =DCOUNTA(database, field, criteria) To count the number of students that were paid $5.40, type the following function: =DCOUNTA(C3:G15,D3,C40:D41) field as cell reference 40 =DCOUNTA(C3:G15,2,C40:D41) field as 41 column =DCOUNTA(C3:G15,"Student",C40:D41) field as field name 1 student C Pay rate 5.40
Results
DGET: Locates a single record matching the specified criteria and displays the results of the requested field. If multiple records meet the criteria, an error message will occur. Syntax Example =DGET(database, field, criteria) To display the student who worked 15 hours during a pay period, type the following function: 37 =DGET(C3:G15,D3,G37:G38) field as cell 38 reference> =DGET(C3:G15,2,G37:G38) field as column =DGET(C3:G15,"Student",G37:G38) field as field name Chris G Hours 15
Results
DMAX: Returns the highest number for the field column of records matching the criteria. 46
Syntax Example
=DMAX(database, field, criteria) To determine the maximum number of hours worked during pay period 16, type the following function: 37 =DMAX(C3:G15,F3,E37:E38) field as cell 38 reference =DMAX(C3:G15,4,E37:E38) field as column =DMAX(C3:G15,"Hours",E37:E38) field as field name 11 hours E PP# 16
Results
DMIN: Returns the smallest number for the field column of records matching the criteria. Syntax Example =DMIN(database, field, criteria) To determine the minimum number of hours worked during pay period 16, type the following function: 37 =DMIN(C3:G15,F3,E37:E38) field as cell 38 reference =DMIN(C3:G15,4,E37:E38) field as column =DMIN(C3:G15,"Hours",E37:E38) field as field name 8 hours E PP# 16
Results
Naming Ranges: Tips Creating Range Names Adjusting Range References Deleting Range Names Using Range Names in Formulas/Functions Using Range Names: Additional Options 47
The name should be descriptive (grades is more descriptive than range1). The first character must be a letter or an underscore character. Other characters can be letters, numbers, or periods. The name cannot look like a cell reference (e.g., "A1", "R1C1"). To separate words, the underscore character or a period must be used instead of a space. The name can be up to 255 characters long. The names are not case sensitive; they can contain upper and lowercase letters. If you name one range BUDGET and a second range Budget, Excel will overwrite the first range with the second one.
3. In the Names in workbook text box, type the desired range name 4. Click OK The range name is created.
select
Formula
Bar.
3. Type the desired range name 4. Windows: Macintosh: Press The range name is created.
Press [return]
[Enter]
a. Windows: Click COLLAPSE DIALOG Macintosh: Click COLLAPSE DIALOG b. Select the cells to be included in the range HINT: To select non-contiguous cells, press the [Ctrl] key for Windows or the [command] key for Macintosh while clicking the cells. c. Windows: Click RESTORE DIALOG Macintosh: Click EXPAND DIALOG 2. Click ADD 3. Repeat steps 2-4 as necessary for additional ranges 4. Click OK The range names are created.
To delete a range name, use the following directions: 1. From the Insert menu, select Name Define... The Define Name dialog box appears. 2. From the Names in workbook scroll box, select the range name to be deleted 3. Click DELETE 4. To delete other range names, repeat steps 2-3 as necessary 5. Click OK The range name(s) are deleted.
2. To add the range name, type it into the formula/function EXAMPLE: =SUM(RangeName) 3. Continue creating your formula/function, repeating step 2 as necessary to add other range names
Adding Subtotals Adjusting Views with Subtotals Removing Subtotals Re-sorting the Data
Adding Subtotals
1. Sort the data NOTES: For more information, refer to Using the Sort Command. Sorting the database is important for grouping the information you want subtotaled. If you do not have column labels on what you are subtotaling, Excel will prompt you to enter column labels or to choose the top row as your column labels. Be aware that if you choose the first row as your column labels, that data will not be included in the subtotals. 2. Select a cell within the database 51
3. From The
the Subtotal
Data dialog
menu, box
select
Subtotals... appears.
4. 5. 6. 7.
From the At each change in pull-down list, select the desired option From the Use function pull-down list, select the desired function From the Add subtotal to scroll box, select the desired column label OPTIONAL: At the bottom of the dialog box, select/deselect the appropriate options 8. Click OK Subtotal lines are added to the database along with outlines for adjusting the view of the data.
52
Removing Subtotals
If you no longer need the subtotals, you can easily remove them with a command rather than deleting each row. To remove the subtotals, use the following instructions: 1. Select a cell within the database 2. From the Data The Subtotal dialog box appears. 3. Click The subtotals are removed. menu, REMOVE select Subtotals... ALL
Organizing Worksheets
Organizing the worksheets within your workbook files can make your Excel documents easier to maintain and manage.
Renaming Worksheet Tabs Changing Worksheet Tab Colors Inserting Worksheets Moving Worksheets Copying Worksheets Deleting Worksheets
3. Type the new sheet name 4. Press [Enter] The worksheet is renamed.
or
[return]
3. Select the desired tab color 4. Click The worksheet tab color is changed.
OK
54
The
Format
Tab
Color
dialog
box
appears.
2. Select the desired tab color 3. Click The worksheet tab color is changed.
OK
Inserting Worksheets
The Excel default for new workbooks is 3 worksheets. If you need additional sheets, you can easily insert them.
The Insert dialog box appears. 2. Select the General tab 3. Select Worksheet 4. Click OK The new worksheet is inserted in front of the current worksheet. Macintosh: 1. Press [control] + click the appropriate SHEET tab select Insert... The Project Gallery dialog box appears. 2. Select the New tab 3. Select Worksheet 55
4. Click OPEN The new worksheet is inserted in front of the current worksheet.
Moving Worksheets
You may want your worksheets in a particular order when printing the final document. You may also want to rearrange the order for easier access while working on a file or to group similar worksheets together. If the original worksheet order no longer fits your needs, you can rearrange worksheets within the same workbook or move a worksheet to another workbook.
3. From the To book pull-down list, select the current workbook 4. From the Before sheet scroll box, select where the sheet will be moved NOTE: The sheet will be placed in front of the sheet you select. 5. Click OK The worksheet is moved.
2. Drag the sheet icon to the The arrow indicates where the sheet will be placed.
desired
location 56
mouse
button
5. To move the worksheet to an existing workbook, from the To book pull-down list, select the destination workbook To move the worksheet to a new workbook, from the To book pull-down list, select (new book) 6. From the Before sheet scroll box, select where the sheet will be moved NOTE: The sheet will be placed in front of the sheet you select. 7. Click OK The worksheet is moved.
Copying Worksheets
You may need to create a copy of a worksheet if the same information is needed in multiple files. Or, you may want to use the same format without having to reformat a new worksheet. For example, if you have created a worksheet for one project but do not want to recreate the worksheet for another project, copying the worksheet saves you the time of creating another worksheet.
2. From the Edit menu, select Move or Copy Sheet... The Move or Copy dialog box appears. 3. Select Create a copy 4. From the Before sheet scroll box, select where the sheet will be pasted NOTE: The sheet copy will be placed in front of the sheet you select. 5. Click OK The worksheet is copied.
Deleting Worksheets
If you no longer have a need for a particular worksheet, you can delete that sheet from the workbook.
Grouping Worksheets Ungrouping Worksheets Formatting Worksheet Groups Printing Worksheet Groups
Grouping Worksheets
1. Click the SHEET tab of the first sheet to be grouped 2. Windows: To select non-contiguous sheets, press [Ctrl] + click the sheets to be grouped Macintosh: To select non-contiguous sheets, press [command] + click the sheets to be grouped To select contiguous sheets, press [Shift] + click the last sheet to be grouped NOTE: The tabs of the selected sheets will appear white. Unselected sheets' tabs will remain unchanged (colors may differ based on your windows color scheme). 3. Windows: When all the sheets of the group are selected, release the [Shift] or [Ctrl] key Macintosh: When all the sheets of the group are selected, release the [shift] or [command] key The selected worksheets are grouped. NOTE: The notation [Group] appears next to the filename.
Ungrouping Worksheets
When you are finished working with your sheet groups, you will need to ungroup them.
To format groups of sheets, use the following instructions: 1. Group the worksheets 2. On the current worksheet, select the cell(s) to be formatted 3. Using the Formatting toolbar or the Format menu, apply the appropriate formatting NOTE: For more information about formatting options, refer to Formatting Your Worksheets. 4. Repeat steps 2-3 as necessary 5. Ungroup the worksheets
60
5. Windows: Macintosh: Click The selected worksheets are printed. 6. Ungroup the worksheets
Click PRINT
OK
Naming Ranges: Tips Creating Range Names Adjusting Range References Deleting Range Names Using Range Names in Formulas/Functions Using Range Names: Additional Options
The name should be descriptive (grades is more descriptive than range1). The first character must be a letter or an underscore character. Other characters can be letters, numbers, or periods. The name cannot look like a cell reference (e.g., "A1", "R1C1"). To separate words, the underscore character or a period must be used instead of a space. The name can be up to 255 characters long. The names are not case sensitive; they can contain upper and lowercase letters. If you name one range BUDGET and a second range Budget, Excel will overwrite the first range with the second one.
The
Define
Name
dialog
box
appears.
3. In the Names in workbook text box, type the desired range name 4. Click OK The range name is created.
Press [return]
[Enter]
a. Windows: Click COLLAPSE DIALOG Macintosh: Click COLLAPSE DIALOG b. Select the cells to be included in the range HINT: To select non-contiguous cells, press the [Ctrl] key for Windows or the [command] key for Macintosh while clicking the cells. 62
c. Windows: Click RESTORE Macintosh: Click EXPAND DIALOG 2. Click ADD 3. Repeat steps 2-4 as necessary for additional ranges 4. Click OK The range names are created.
DIALOG
Both functions will yield the same result. The second is often easier to write, understand, and troubleshoot. If you cannot recall a range name when you are writing a function/formula, you can use one of the following methods to determine your names and to include them in the function/formula. For more information, refer to Creating Range Names.
Efficiently navigating a workbook can be challenging when the workbook or worksheets are large. This document includes tips and shortcuts for navigating a large worksheet and multiple open workbooks.
Keyboard Shortcuts Using the Go To Command Moving Between Open Workbooks Using Screen Options
Keyboard Shortcuts
Learning keyboard shortcuts will save you time when working with your workbook. There are several keyboard shortcuts available to help you move around your worksheets and workbook more efficiently. The following table displays some common shortcuts and their keyboard combinations. To... Move to the next sheet Move to the previous sheet Move to the next open workbook Press... [Ctrl] + [Page Down ] [Ctrl] + [Page Up ] Windows: [Ctrl] + [F6] Macintosh: [command] + [F6] OR [Ctrl] + [Tab]
Move to workbook
the
previous
open Windows: [Ctrl] + [Shift] + [F6] Macintosh: [command] + [shift] + [F6] OR [Ctrl] + [Shift] + [Tab]
65
1. From the Edit menu, select Go To... OR Press [F5] or [Ctrl]+[G] The Go To dialog box appears. 2. From the Go to scroll box, select the range name OR In the Reference text box, type the cell location EXAMPLE: A1, C1:C5, A1:G1 3. Click OK
columns. This means that, regardless of where you are in the worksheet, you can see the information in that row and/or column at all times. Freezing a Row and a Column 1. Place your cursor in the cell below and to the right of the row and column you want to freeze 2. From the Window menu, select Freeze Panes The row and column above and to the left of the cursor are frozen. Freezing a Row 1. Within column A, select the row directly below the row you want to freeze 2. From the Window menu, select Freeze Panes The row is frozen. Freezing a Column 1. Within row 1, select the column directly to the right of the column you want frozen 2. From the Window menu, select Freeze Panes The column is frozen. OPTIONAL: If you would like to print frozen columns on every page, refer to Other Excel Printing Options: Repeating Items on Each Page. Unfreezing Rows and Columns 1. From the Window menu, select Unfreeze Pane
67
being
split
into
four
using
the
Menu
option:
Splitting the Screen: Menu Option 1. Select the cell where you would like the worksheet split 2. From the Window menu, The screen will be split into four sections. Splitting the Screen: Mouse Option 1. Point to the black line above the vertical scroll arrow or to the right of the horizontal scroll arrow The pointer will turn into a double arrow. select Split
2. Click and drag the Split Bar to the desired location 3. Release the mouse Your screen will be split in two sections. 4. OPTIONAL: To split the screen into four sections,
button
a. Point to the black line you did not use to create the first split The pointer will turn into a double arrow. 68
b. With the double arrow, click and drag the Split Bar to the desired location c. Release the mouse button Unsplitting the Screen: Menu Option 1. From the Window menu, The screen will return to a normal view. Unsplitting the Screen: Mouse Option 1. Drag each Split Bar back to its original position (above the vertical scroll bar or to the left of the horizontal scroll bar) OR Double click each Split Bar select Remove Split
Performing Workbook
Calculations
in
Your
Excel performs its calculations through formulas and functions (a function is a prewritten formula) which are shortcuts for working with your document. For example, rather than writing a formula to add numbers, count them, and divide to find the average, you can just use the Average function. It tells the computer what it needs to do to find the average of the numbers, so you do not need to type in all of the commands to find an average. This document has been designed to examine the usage of formulas as well as provide some existing formulas to make working with your workbook and worksheets faster.
69
While multiple worksheets can make working with your workbook more manageable, writing formulas that include information on different worksheets is more complicated. However, when writing formulas, you can create a link between cells on one or more worksheets within the same workbook. Using Special Characters Five symbols can be used when creating a formula that links two separate worksheets. Each of these symbols can be placed directly into the formula to complete its respective function. Character Use within Formula ! ' [] : + Place between the worksheet name and cell reference Place around the filename and sheet name or when a sheet name contains a space ('Budget 2001'!C4:C8) Place around a filename Signifies a range (B3:C2 means B3 through C2) Signifies a range (B3+C2 means B3 and C2)
NOTE: The following examples assume that the worksheets Budget and Salary are located within the workbook 03Budget.xls. Creating a Link to Another Worksheet (same file) Excel allows you to create links to other worksheets. 1. Select the cell where you want the formula to appear 2. To create the formula, use this format: =function_name(worksheet_name! cell_reference) EXAMPLE: =SUM(Budget!C4:C8) EXAMPLE: (with space in sheet name) =SUM('Budget 2003'!C4:C8) 3. To accept the formula, press [Enter] or [return] Creating a Link to More than One Worksheet (same file) Excel allows you to create links to more than one worksheet at a time. 1. Select the cell where you want the formula to appear 2. To create the formula, use this format: =function_name(worksheet range! cell_reference) EXAMPLE: =SUM(Budget:Salary!D2:D10) EXAMPLE: (with space in sheet name) =SUM('July 2003:June 2004!'C4:C8) NOTE: Be sure to include a plus sign (+) or colon (:) between the worksheet range. 70
WARNING: Excel has an option for automatically calculating before you save your work, but not before you print. If you change to manual calculation, you will need to make sure that you recalculate before you print, and especially before others view your document.
2. Select the Calculation tab 3. Under Calculation, select Manual 4. Click OK Macintosh:
72
1. From The
menu, dialog
select box
Preferences... appears.
2. From the list on the left, select Calculation 3. Under Calculation, select Manual 4. Click OK Calculating Your Workbook Manually To use the Manual Calculation feature, you have two options: the keyboard or Options dialog box. Keyboard Option: 1. Windows: Macintosh: Press [command] + [=] Menu Option: Windows: 1. From the Tools menu, The Options dialog box appears. 2. Select the Calculation tab 3. Under Calculation, click CALC NOW (F9) 4. Click Your data is now updated. Macintosh: 73 select Options... Press [F9]
OK
1. From the Excel menu, select The Preferences dialog box appears. 2. From the list on the left, select Calculation 3. Click CALC NOW Your data is now updated.
Preferences... (CMD+=)
Introduction to Troubleshooting
As you are reviewing your worksheets, asking yourself the following questions can help you identify problems within your worksheet and ensure the integrity and accuracy of your worksheets.
Compute some formulas by hand; do they equal Excel's results? Are the numbers reasonable and within the expected range? Verify the accuracy with source documents; make sure you transferred the information correctly. Do your labels accurately describe the values within the worksheet? When multiplying numbers by values with decimals, do the values that print out add up correctly? This is a common problem because of Excel's automatic rounding. When creating formulas that you find awkward, use values that are easy to test.
74
When you try to enter a formula containing a circular reference, a dialog box appears, helping you avoid such references. The Formula Auditing and Circular Reference toolbars can also help you avoid circular references. To access the Formula Auditing toolbar:
Windows: 1. From The the View menu, Formula select Toolbars Auditing Formula toolbar Auditing appears.
Macintosh: 1. From The the View menu, Auditing select Toolbars toolbar Auditing appears.
To access the Circular Reference toolbar: 1. Windows: From the View menu, select Toolbars Customize... The Customize dialog box appears. Macintosh: From the View menu, select Toolbars Customize Toolbars/Menus... The Customize Toolbars/Menus dialog box appears. 2. Select the Toolbars tab 3. From the Toolbars scroll box, select Circular The Circular Reference toolbar
Reference appears.
4. Click OK
Protection Options Locking & Unlocking Cells Workbook Level Protection Worksheet Level Protection File Level Protection
Protection Options
When you are protecting your workbook, you have two primary options:
Prevent data entry for select cells Users can access the worksheet and view the information; however, access for making changes is restricted. For more information, refer to Locking & Unlocking Cells. Restrict or prevent access to the file Users can be prevented from viewing the worksheet, or users can view the workbook but not make changes to it. For more information, refer to File Level Protection.
Protect Sheet dialog box. Therefore, if you enable protection, no changes can be made to a cell until you unlock that cell.
Locking Cells
You can easily lock any cell in a worksheet. NOTE: Make sure to lock the cells before you protect the sheet or document. Once a sheet or a document has been protected, you cannot access menu selections that allow you to make changes to cells. 1. Select the cell(s) to be locked 2. From the Format The Format Cells dialog box appears. 3. Select the Protection tab 4. Select There will be a menu, select Cells... Locked it.
check
before
Unlocking Cells
In order to unlock cells, sheet protection must first be turned off. For more information, refer to Worksheet Level Protection or Workbook Level Protection. 1. Unprotect the worksheet 2. Select the cells you want to unlock 3. From the Format The Format Cells dialog box appears. 4. Select the Protection tab 5. Deselect There will no longer be a check before it. 6. Click The cells are unlocked.
menu,
select
Cells... Locked OK
1. From The
the
Tools Protect
Protection dialog
Protect box
Workbook... appears.
2. In the Protect Workbook dialog box, select the appropriate option(s): Option Description
Structure Prevents the user from changing the order of the sheets within a workbook. This includes adding or deleting worksheets. Windows Prevents the user from being able to resize or move the window. Password Allows only those who know the password to turn the workbook protection off. 3. Click OK The workbook is protected.
78
1. From The
the
Tools Protect
Protection dialog
Protect box
Sheet... appears.
2. In the Protect Sheet dialog box, select the appropriate options: Option Description
Protect worksheet and contents of Prevents changes to locked cells. locked cells Password to unprotect sheet Allows only those who know the password to unprotect the worksheet.
Allow all users of this worksheet Checked boxes are aspects that any user can to access. 3. Click OK The worksheet is protected. Macintosh:
79
1. From The
the
Tools Protect
Protection dialog
Protect box
Sheet... appears.
2. In the Protect Sheet dialog box, select the appropriate options: Option Description
Contents Prevents changes to locked cells, columns or rows, chart sheet, and any formulas in the cells Objects Prevents changes to graphic objects (e.g., text boxes, an embedded chart). Scenarios Prevents changes to scenarios (i.e., any input values you substituted in a worksheet). Password Allows only those who know the password to unprotect the worksheet. 3. Click OK The worksheet is protected.
80
the
Tools
select box
3. To prevent unauthorized access to the file, in the Password to open text box, type a password To prevent unauthorized changes to the file, in the Password to modify text box, type a password 4. Click OK The Confirm Password dialog box appears. 5. In the Reenter password to proceed/modify text box, type the password(s) in the order of the password(s) that you typed in the Save Options dialog box HINT: If you type apple in the Password to open text box and orange in the Password to modify text box, you must type apple in the first confirmation dialog box and orange in the second confirmation dialog box. 6. Click OK 7. Click SAVE
81
About Charting
Charts are objects on your worksheet that can be moved, resized, and deleted without affecting your worksheet. If the chart is placed on top of information, the information will not be modified or lost.
Charting Rules
Excel follows seven basic rules for creating charts with the Chart Wizard. Understanding these rules can help avoid frustration and reduce the steps necessary for creating charts. Once the chart is created, you can modify it to meet your needs. Rule Rule 1 Description Excel does not automatically add a chart title to your chart based on the first row of selected information. A chart title can be added during the creation process or later Excel does not automatically add a chart subtitle to your chart based on the second row of selected information. A subtitle can be added after the chart is created Blank rows and columns in your information are not ignored. Excel will leave a blank bar or pie slice for every blank row or column in your information If the data contains more rows than columns, Excel will plot the data by column. The first column becomes the X-axis labels; the balance of the columns are the data series. The first row becomes the legend's labels If the data contains more columns than rows, Excel will plot the data by row. The first row becomes the X-axis labels; the balance of the rows are the data series. The first column becomes the legend's labels If the data contains an equal number of rows and columns, Excel defaults to plot the data by rows but gives you the option to plot by columns If only numeric data is selected, Excel follows rules 4 and 5
Rule 2
Rule 3
Rule 4
Rule 5
Rule 6
Rule 7
In the following example, notice how the blank cells in the data series create blanks spaces in the chart. The lack of row labels makes it difficult for the reader to understand the chart, because no legend exists to guide them.
The following table describes the various elements. Element Title (Subtitle) Category (X) Axis Category Axis Title Value Axis Purpose Identifies the chart and frequently includes a date or time period Identifies the data being charted on the horizontal x-axis. Examples of Category (X) Axis types include dates, projects, and salespersons Identifies the title of the Category (X) Axis
(Y) Identifies the data being charted on the vertical y-axis. Examples of Value (Y) Axis types include numbers and years
Value Axis Identifies the title of the Value (Y) Axis Title Legend Identifies the information charted. This is especially important when you have more than one type of information charted. For example, if you have a chart for enrollment by class (freshman, sophomore, junior, senior), a legend will be important for identifying which information relates to what class Ticks, indicating measurement increments, appear on both the y-axis and xaxis and can help improve the readability of a chart. Both y-axis and x-axis ticks are optional The origin is the point where the x-axis and y-axis meet. The origin is generally at zero (0) but can be modified
Ticks
Origin
84
General Hints
Generally, effective charts use the simple techniques of good design. Any reference material discussing page layout will assist you in this area. Some design techniques are especially important, as they relate directly to charting. These techniques include the following: Choosing the correct chart format Chart formats are designed to portray certain types of information; therefore, choose the correct chart format for your information. Maintaining simplicity Clarifying information is the main goal of creating a chart, so complicated charts only serve to make your information less clear. Maintaining consistency When creating several charts, use a design grid. This grid will help you maintain a consistent chart format, eliminating distractions for your audience. Using labels Effective use of labels that are created using legible typefaces will assist your audience in understanding a chart's information. Each of these design factors is important, but the choice of chart format comes first. For this reason, the following sections discuss the design considerations for three of the most common chart formats.
Pie Charts
85
Pie charts are best used to compare parts of a whole; in other words, they help divide a group into components. Some factors to keep in mind when creating pie charts include the following:
Source: UWEC Campus Profile, 2001 Limiting the number of slices Keep the number of slices to a minimum by combining smaller categories into one. Too many slices will hinder interpretation by making your pie chart appear complicated and cramped; it will also create difficulties for labeling. Using labels for slices Try to place labels within slices whenever possible; this will help you create pie charts that are both clear and readable. Focusing attention If necessary, draw your audience's attention to the particular slices you are discussing, perhaps by "exploding" it to make it appear separate from the pie or by selecting a dominant color or pattern. For more information on enhancing pie chart effects, refer to Using Pie Chart Options. Enhancing the chart Consider enhancing the appearance of the pie chart, perhaps by adding perspective. Keep in mind, however, that three-dimensional pies can sometimes make certain slices appear larger than they really are; thus, your pie chart may be misleading.
Bar Graphs
Bar graphs work best to emphasize the contrast between quantities. Two types of bar graphs can be used: vertical and horizontal. Vertical bar graphs work well for comparing quantities at different times, while horizontal bar graphs compare different quantities when time is not an important consideration. For example, a graph showing student enrollment by year would probably work best in the vertical format, while a graph showing current participation in faculty organizations would be most effective in the 86
horizontal format. Some design considerations to keep in mind when creating either type of bar graph include the following:
Source: UWEC Campus Profile, 2001 Limiting the scale Make sure your bar graph is kept within a reasonable scale; in other words, try to avoid showing three quantities of similar size and one quantity that is drastically larger or smaller. Enhancing the graph Consider adding perspective or a drop shadow to your chart for visual appeal, but again, be aware that (as with pie charts) the third dimension can confuse or even mislead the audience. Numerical values placed above or within the bars themselves may help solve this problem. For more information, refer to Formatting Your Chart.
Line Graphs
Line graphs best indicate the relationship of one variable to another, and they can be created using either straight or curved lines. Which type of line graph you use depends on the type of information you wish to convey: straight-line graphs show specific observation points, while curved-line graphs show general trends. Some design 87
considerations to keep in mind when creating either type of line graph include the following:
Source: UWEC Institutional Planning, 1999-2003 Using contrast Make sure to use lines with sufficient contrast; in other words, create a line that is bold enough to clearly appear to your audience but thin enough to still convey specific information. Limiting multiple lines When using multiple lines to compare trends, keep the number of lines to three or less. Comparing more than three trends on the same line graph can create confusion for your audience, especially if your graph is not in color.
Summary
Adhering to the guidelines in this document will help you create charts and graphs that present information clearly. Of course, the three chart formats discussed here are not the only ways to convey numerical data; other formats can effectively portray information as well. The following table provides a quick guide to most of your choices: 88
Description Compares parts of a whole Shows contrast between quantities Indicates the relationship of one variable to another Indicates the volume relationship of one variable to another Correlates two factors by marking the points where particular events occurred
Each chart format has its own design considerations, but you have plenty of room for experimentation. You can use your computer software to try new techniques. As long as you choose the correct format and keep in mind the general concepts of simplicity, consistency, and labeling, you will be well on your way toward creating an effective chart that is understandable and effective.
89
A summary section will include the information to be charted in a contiguous group. The more complete the summary section, the less work you will have to do when creating your chart. Based on the Charting Rules, an organization similar to the following graphic will make it easiest for automatic charting. While this setup may not always be appropriate, keep in mind the format can reduce the amount of adjustments required for your charts.
This sample worksheet section was used to create the following chart. Aside from telling Excel to create a chart and indicating where the chart was to appear, the default setup created the chart.
Charts can be enhanced by modifying the individual chart elements or by adding a new data series. Notice that the chart title and subtitle are not included in the chart. Excel requires that these be added after the chart is created or during the Chart Wizard process.
90
Using the Chart Wizard Modifying a Chart Changing the Chart Type Working with Ranges / Data Series Positioning Your Chart
11. In the appropriate text boxes, type the desired x- and y-axes labels and click NEXT The Chart Wizard - Step 4 of 4 - Chart Location dialog box appears. NOTE: For more information, refer to Working with Axes. 12. To make your chart appear within the Excel sheet, a. Select As object in b. From the pull-down box, select the desired worksheet To make your chart appear as a separate sheet, c. Select As new sheet d. OPTIONAL: In the text box, type a name for the new worksheet 2. Click FINISH The chart is created. NOTE: To enhance this chart, refer to Modifying a Chart.
Modifying a Chart
Once your chart is created, you can modify it to fit your needs or the evolving nature of your data. For more information, refer to the following documents:
92
OR To select a cell range, a. Windows: Click COLLAPSE Macintosh: Click COLLAPSE DIALOG b. Select the data range to be added c. Windows: Click RESTORE Macintosh: Click EXAPAND DIALOG 2. Click OK The data series is added. DIALOG DIALOG
Adding formatting to your chart can greatly enhance its overall appearance and clarity. Formatting is also a way to emphasize important areas of your chart. Some useful formatting options include colors, patterns, arrows, text boxes, and font types.
Selecting Chart Elements Adjusting the Chart Colors and Patterns Adding Arrows and Text Boxes Adjusting Chart Fonts
Adding a Chart Title Working with Legends Working with Axes Creating Charts with a Percent Scale Adding Data Labels to Your Chart Working with Grids
96
3. Select
the
Titles
tab
4. In the Chart title text box, type the desired title 5. Click OK The title is now added to your chart.
97
Macintosh:
Under
Type,
select
the
desired
legend
placement
4. Click OK
Scaling an Axis
1. Double click the axis The Format Axis dialog box appears. 2. Select the you Scale want to tab adjust
1. Click your chart to select it 2. From the Chart menu, The Chart Options dialog box appears. 3. Select the Data Labels tab 4. Select the desired data label option 5. Click OK
select
Chart
Options...
1. Click your chart to select it 2. From the Chart menu, The Chart Options dialog box appears. 3. Select the Data
select
Chart Labels
Options... tab
4. To display the value for a series, select To display the label for a series in the chart, select Series name 5. Click OK Macintosh: 1. Click your chart to select it 2. From the Chart menu, The Chart Options dialog box appears. 3. Select the Data select Chart Labels
Value
Options... tab
4. To display the value for a series, select To display the label for a series in the chart, select Show label 5. Click OK
Show
value
Inserting Gridlines
1. Click your chart to select it 100
2. From the Chart menu, select Chart Options... The Chart Options dialog box appears. 3. Select the Gridlines tab NOTE: This tab will not exist with some charts (e.g., pie charts) that do not use gridlines. 4. Make adjustments as desired 5. Click OK
chart
the slice
outward exploded.
Charting Extras
Extra charting features offered by Excel can be very useful during the different stages of your project. Some of these options include printing charts and data and copying charts into Word. 102
3. 4. 5. 6.
7.
On the Standard toolbar, click COPY The chart is copied. Open the Word document to which the chart will be copied Place the insertion point where the chart should be pasted In Word, from the Edit menu, select Paste Special... The Paste Special dialog box appears. To add the chart as a link, select Paste Link To add the chart without a link, select Paste NOTES: To paste with linking means that when changes are made to the original source chart, the pasted chart will be updated. To paste without linking means when changes are made to the original source chart, the pasted chart will not be updated. Click OK The chart is pasted to Word.
Functions: Rank
The Rank function returns the rank of a value within a list. This function is useful when you need to maintain a sort based on another column and/or when you want to determine the rank of items in more than one column. This document will use the example of a gradebook, sorted alphabetically by student last name. In the example, we want to find the rank of the Quiz 1 score of 47 for Chris Student. Scores on Quiz 1 ranged from 60 to 23.
1. Open the desired worksheet 2. Select the cell where you would like the result of the function to appear 3. From the Insert menu, select Function... OR Windows: The On the Insert Formula Bar, Function click INSERT FUNCTION dialog box appears. 104
Macintosh: On the Standard toolbar, click PASTE FUNCTION The Paste Function dialog box appears. 4. Windows: From the Or select a category pull-down list, select All or Statistical Macintosh: From the Function category scroll box, select All or Statistical 5. Windows: From the Select a function scroll box, select RANK Macintosh: From the Function name scroll box, select RANK 6. Click OK The Function Arguments dialog box appears.
7. In the Number text box, type the value of which you want to know the rank EXAMPLE: Type 47 8. In the Ref text box, type the cell range to be included EXAMPLE: Type C2:C6 OR a. Click COLLAPSE DIALOG or b. Select the cells to be included c. Click RESTORE DIALOG or 2. To obtain the rank of a value where the list of values is sorted in descending order, in the Order text box, type 0 or leave the text box blank To obtain the rank of a value where the list of values is sorted in ascending order, in the Order text box, type any nonzero value NOTE: This action does not sort the information in your worksheet; it is used only as a reference from which to perform the ranking. EXAMPLE: To find the rank of 47 when the Quiz 1 scores are sorted from high to low, type 0 3. Click OK The rank appears in the selected cell and the formula appears in the Formula Bar. EXAMPLE: Chris Student's score ranks 4th when the scores are sorted high to low (60, 54, 50, 47, 23).
105
Countif Sumif
Countif
The Countif function counts the number of items that meet a certain criteria. This criteria can be a number range or a word. This is useful when determining the number of entries within a certain range, such as test scores or the number of entries that equal a certain value, like the class rank of "junior" or "senior." 1. Open the desired worksheet 2. Select the cell where you want the result of the function to appear 3. From the Insert menu, select OR Windows: The On the Insert Formula Bar, Function
Function...
Macintosh: On the Standard toolbar, click PASTE FUNCTION The Paste Function dialog box appears. 4. Windows: From the Or select a category pull-down list, select All or Statistical Macintosh: From the Function category scroll box, select All or Statistical 5. Windows: From the Select a function scroll box, select COUNTIF Macintosh: From the Function name scroll box, select COUNTIF 6. Click OK The Function Arguments dialog box appears.
106
7. In OR
the
Range
text
box,
type
the
range
of
cells
a. Click COLLAPSE DIALOG or b. Within your worksheet, select the range of cells to analyze NOTE: These are the cells which will be analyzed to see if they meet the criteria you select. c. Click RESTORE DIALOG or 2. In the Criteria text box, type the appropriate criteria, such as the numerical range, text value, or expression (e.g., >2) EXAMPLE: To count the number of students with a class rank of "senior," type senior 3. Click OK The appropriate number appears in the cell you selected and the formula appears in the Formula Bar. EXAMPLE: The formula should look something like =COUNTIF(C2:C11,"senior") with C2:C11 being the range, and "senior" the criteria.
Sumif
The Sumif function adds all items that meet a certain criteria. For example, you could add all the scores of students with a class rank of "senior." 1. Open the desired worksheet 2. Select the cell where you want the result of the function to appear 3. From the Insert menu, select OR Windows: The On the Insert Formula Bar, Function
Function...
Macintosh: On the Standard toolbar, click PASTE FUNCTION The Paste Function dialog box appears. 4. Windows: From the Or select a category pull-down list, select All or Math & Trig Macintosh: From the Function category scroll box, select All or Math & Trig 5. Windows: From the Select a function scroll box, select SUMIF Macintosh: From the Function name scroll box, select SUMIF
107
6. Click The
7. In OR
the
Range
text
box,
type
the
range
of
cells
a. Click COLLAPSE DIALOG or b. Within your worksheet, select the range of cells to analyze NOTE: These are the cells which will be analyzed to see if they meet the criteria you select. c. Click RESTORE DIALOG or 2. In the Criteria text box, type the appropriate criteria (such as the numerical range or text value) EXAMPLE: If you would like to add the test scores of the students with a class rank of "senior," type senior OR a. Click COLLAPSE DIALOG or b. Within your worksheet, select the appropriate criteria c. Click RESTORE DIALOG or 3. In the Sum_range text box, type the range of cells EXAMPLE: If you would like to add the text scores of seniors, select the cell range that contains the test scores OR a. Click COLLAPSE DIALOG or b. Within your worksheet, select the range of cells to analyze NOTE: These are the cells which will be summed of the criteria has been met. c. Click RESTORE DIALOG or 4. Click OK The sum appears in the selected cell and the formula appears in the Formula Bar. EXAMPLE: The formula should look something like =SUMIF(C2:C11,"senior") with C2:C11 being the range and "senior" being the criteria. 108
Functions: Concatenate
The Concatenate function creates a text string by pulling data from specified fields. This function can join information such as first and last names, or names and scores, which are in separate fields. Up to 30 fields may be added together in this fashion. To create multiple text strings using identical sets of fields, you can select a range of cells in the Text text boxes, as long as the cell you selected for the results of the function is a row which includes the selected cells. The function will show only the text string for that row, but you can create text strings for the rest of the selected fields by copying the formula and pasting it into the Formula bar for cells in the corresponding rows for the rest of the information. 1. Open the desired Excel worksheet 2. Select the cell where you would like the result of the function to appear This should be in the same row as the information you will use to create a text string from. 3. From the Insert menu, select Function... OR Windows: The From the Insert Formula bar, Function click INSERT FUNCTION dialog box appears.
Macintosh: From the Standard toolbar, click PASTE FUNCTION The Paste Function dialog box appears. 4. Windows: From the Or select a category pull-down list, select All or Text Macintosh: From the Function category scroll box, select All or Text 5. Windows: From the Select a function scroll box, select CONCATENATE Macintosh: From the Function name scroll box, select CONCATENATE
109
6. Click The
7. In OR
the
Text
text
box,
type
the
range
of
cells
a. Click COLLAPSE DIALOG or b. On your worksheet, select the cells to include c. Click RESTORE DIALOG or 2. To add supplementary text between fields, in a separate text box, type the text in quotation marks. To add a space between fields, in a separate text box, type " ". 3. Repeat steps 7 and 8 for as many of the Text text boxes as necessary NOTES: When you click in the last text box available, another will appear, up to a maximum of 30. If you are using more text boxes than can be displayed, use the scroll bar on the right to view them. 4. Click OK The text string appears in the selected cell and the formula appears in the Formula bar. EXAMPLE: The formula should look something like =CONCATENATE(B2," ",A2) with B2 being Text 1, a space being Text 2, and A2 being Text 3.
Functions: Subtotal
110
The Subtotal function sections off a part of the worksheet so that calculations can be performed upon it. There are 11 different calculations which you can have performed on the subset of the worksheet, as shown in the Function Numbers table. You must select one of these calculations to be initially performed on the subset. You may, however, change the selection at any time by modifying the existing function if you need to perform other calculations on the data.
Function Numbers Using the Subtotal Function Filtering Modifying the Subtotal Function
Function Numbers
# 1 2 3 4 5 6 7 8 9 1 0 1 1 Calculation Description AVERAGE adds all entries and then divides by the number of entries COUNT COUNTA MAX MIN STDEV STDEVP SUM VAR VARP counts the number of entries containing numbers counts the number of entries that are not blank (includes text entries) reports the highest number of all the entries reports the lowest number of all the entries computes the standard deviation, assuming the selection is a sample of the entire population computes the standard deviation, assuming the selection is the entire population adds all entries together computes the variance, assuming the selection is a sample of the entire population computes the variance, assuming the selection is the entire population
1. Open the desired worksheet 2. Select the cell where you want the result of the function to appear NOTE: If filtering your worksheet, make sure that the selected field is below your data, allowing you to see the results. 3. From the Insert menu, select Function... OR Windows: The On the Insert Formula Bar, Function click INSERT FUNCTION dialog box appears.
Macintosh: On the Standard toolbar, click PASTE FUNCTION The Paste Function dialog box appears. 4. Windows: From the Or select a category pull-down list, select All or Math & Trig Macintosh: From the Function category scroll box, select All or Math & Trig 5. Windows: From the Select a function scroll box, select SUBTOTAL Macintosh: From the Function name scroll box, select SUBTOTAL 6. Click OK The Function Arguments dialog box appears.
7. In the Function_num text box, type the number of the function you would like to perform NOTE: For more information, refer to Function Numbers. 8. In the Ref1 text box, type the range of cells OR a. Click COLLAPSE DIALOG or b. Select the range of cells to include c. Click RESTORE DIALOG or 2. Repeat step 8 for as many of the Ref text boxes as necessary NOTE:You may select up to 29 different fields to include in the subtotal. 3. Click OK The subtotal appears in the selected cell and the formula appears in the Formula Bar. HINT: The formula should look similar to =SUBTOTAL(1,D2:D11) with 1 (average) being the Function_num, and D2:D11 being Ref1. 112
Filtering
After you have your subtotal on a field in your worksheet, you can easily get the same information on subsets of that same field. You can do this by filtering the field. For more information on filtering, refer to Filtering Your Database. 1. Select the row of column headings, such as name, class, or age 2. From the Data menu, select Filter AutoFilter Pull-down lists appear in each of the selected cells.
3. From the desired pull-down list, select the desired option EXAMPLE: If you wanted to find the average age of "Sophomores," from the class cell pull-down list, select Sophomore The worksheet hides all other cells except those meeting the selected AutoFilter criteria. The new average is shown in the same cell where the first subtotal appeared. 4. To return to the unfiltered view, from the Data menu, select Filter AutoFilter
113
Inserting Dynamic Dates and Times Inserting Static Dates and Times
1. Select the cell in which you want the date to appear 2. Windows: Press [Ctrl] + [;] Macintosh: Press [control] + [;] The current date appears in the cell and will not be updated. NOTE: For information on changing the format of the date, refer to Formatting Your Worksheets.
115
Functions in Excel
A function is a small assignment that is performed to produce a result that can be reliably used without caring as to how the function works or how it was created. It is like when you pick up a TV remote control and press a button to change the channel. You dont care how the remote control works and you dont spend any time finding out why the channel changed. As in real world where we use various functions on cars, radio stations, food eating, etc, in the computer world, various functions are made available so you can simply use them to do your job. As a spreadsheet application, Microsoft Excel is equipped with various functions that can solve different types of calculations. In order to use a function more effectively, you should first know whether it is available and what you need to do to make it work. A function involves four main issues: The name of the function: Obviously, in order to use a function, you must know its name. Although the functions are not case-sensitive, it is a good idea to always write them in uppercase. The purpose of the function: what the function used for. Different functions are meant for different purposes. For example, when you press the power button on a TV remote control, the TV gets turned ON or OFF depending on whether it was already ON or OFF. Therefore, the purpose of the power button (that is, its function) is to turn the TV ON or OFF and vice versa What the function needs in order to carry its assignment: this need is called argument (or arguments). A function can use more than one argument. For example, you use one key to turn on the car. Another function may need more than one argument. The arguments can be the same kind. For example, some remote controls use two similar batteries. On a function that takes one argument, the argument may be required. In this case, you must provide it. If you don't, the function will not work (the result would be an error). In other circumstances, an argument may not be required. In this case, if you dont provide the argument, the function would use its own value, called a default argument. If a function takes more than one argument, all arguments may be required. In this case, if you fail to provide all of them, the function would not work. Another function that takes more than one argument may not require all of them. There are even cases when a function takes many arguments but none of them is required. When an argument is not required, you dont have to supply it. The person who creates a function also decides on the number of its arguments, if the argument(s) is/are required and, if the function takes more than one argument, which ones are required, whether all of them are required or none of them is required.
116
The result of the function: after using a function, you need its result so you can use it for its intended purpose. Various functions produce various results but each function is intended for a specific purpose.
117
On the other hand, consider a number such as 24.06. As this number is negative, it is between 24 and 25, with 24 being greater. In arithmetic, the ceiling of a number is the closest integer that is greater or higher than the number considered. In the first case, the ceiling of 12.155 is 13 because 13 is the closest number greater than or equal to 12.155. The ceiling of 24.06 is 24. To find the ceiling of a number, you can use the CEILING function used to obtain the ceiling of a number uses the following syntax: CEILING(number, significance) The function takes two arguments. The number argument is the one that will be considered. The significance argument is the nearest multiple significance
Consider two floating numbers such as 128.44 and -36.72. The number 128.44 is between 128 and 129 with 128 being the lower. The number 36.72 is between 37 and 36 with 37 being the lower. The lowest but closest integer value of a number is referred to as its floor. For example, the floor of 128.44 is 128. The floor of 36.72 is 37.
119
To get the floor of a number, you can use the FLOOR function. Its syntax is: FLOOR(number, significance) The FLOOR() function takes two arguments. The first argument argument is the number to be considered. The second argument is the nearest multiple of significance.
The Exponential
Microsoft Excel provides the EXP function used to calculate the exponential value of a number. Its syntax is: EXP(number) The argument, number, a double-precision value, represents the number to be evaluated. If the value of number is less than -708.395996093 (approximately), the result is reset to 0 and qualifies as underflow. If the value of the argument x is greater than 709.78222656 (approximately), the result is infinity and qualified as overflow.
The Log10
The LOG10 function calculates the base 10 logarithm of a number. The syntax of this function is: LOG10(number)
120
The number to be evaluated is passed as the argument number. The function returns the logarithm on base 10 using the formula: y = LOG10x which is equivalent to x = 10y
Financial Functions
Microsoft Excel provides a series of functions destined to perform various types of financially related operations. These functions use common factors depending on the value that is being calculated. Many of these functions deal with investments or loan financing. The Present Value is the current value of an investment or a loan. For a savings account, a customer could pledge to make a set amount of deposit on a bank account every month. The initial value that the customer deposits or has in the account is the Present Value. The sign of the variable, when passed to a function, depends on the position of the customer. If the customer is making deposits, this value must be negative. If the customer is receiving money (lottery installment, family inheritance, etc), this value should be positive. The Future Value is the value the loan or investment will have when the loan is paid off or when the investment is over. For a car loan, a musical instrument loan, a financed refrigerator, a boat, etc, this is usually 0 because the company that is lending the money will not take that item back (they didn't give it to the customer in the first place, they only lend him or her some money to buy the item). This means that at the end of the loan, the item (such as a car, boat, guitar, etc) belongs to the customer and it is most likely still worth something. As described above and in reality, the Future Value is the amount the item would be worth at the end. In most, if not all, loans, it would be 0. On the other hand, if a customer is borrowing money to buy something like a car, a boat, a piano, etc, the salesperson would ask if the customer wants to put a "down payment", which is an advance of money. Then, the salesperson or loan officer can either use that down 121
payment as the Future Value parameter or simply subtract it from the Present Value and then apply the calculation to the difference. Therefore, you can apply some type of down payment to your functions as the Future Value. The Number Of Periods is the number of payments that make up a full cycle of a loan or an investment. The Interest Rate is a fixed percent value applied during the life of the loan or the investment. The rate does not change during the length of the Periods. It is very important to understand how these two arguments are passed to a function. The period could be the number of months of a year, which is 12; but it could be another length. Suppose a customer is getting a car loan that would be financed in 5 years. This is equivalent to 5 * 12 = 60 months. In the same way, a cash loan can stretch from 0 to 18 months, a carpenter truck loan can have a life financing of 40 months, and a condominium can be financed for 15 years of 12 months plus an additional 8 months; this is equivalent to (15 * 12) + 8 = 188 months. Here is the tricky part, especially as far as Microsoft Excel deals with its finance functions. If you pass the number of Periods in terms of years, such as 5 for a car loan that stretches over 5 years, then you can pass the Rate as a percentage value, such as 8.75%. If you pass the number of Periods in terms of months, for example you can pass it as 44 for a car that is financed in 3 years and 8 months, then you must communicate this to the Rate argument by dividing the Rate by 12. In other words, a Rate of 8.75% would be passed as 8.75%/12. If the Rate was typed in a cell named B2 that displays 8.75%, you can pass it as B2/12. For deposits made in a savings account, because their payments are made monthly, the rate is divided by the number of Periods of a year, which is 12. If an investment has an interest rate set at 14.50%, the Rate would be 14.50/12 = 1.208. Because the Rate is a percentage value, its actual value must be divided by 100 before passing it to the function. For a loan of 14.50% interest rate, this would be 14.50/12 = 1.208/100 = 0.012. The Payment is the amount the customer will be paying. For a savings account where a customer has pledged to pay a certain amount in order to save a set (goal) amount, this would be the amount the customer would pay every month. If the customer is making payments (car loan, mortgage, deposits to a savings account, etc), this value must be negative. If the customer is receiving money (lottery installment or annuity, family inheritance, etc), this value must be positive. The Payment Type specifies whether the payment is made at the beginning or the end of the period. For a monthly payment of an item financed like a car, a boat, a guitar, or a house this could be the end of every month.
122
2. Save it as Business 3. Double-click Sheet1 to put its label into edit mode. Type Future Value and press Enter 4. Click cell C8 and, on the main menu, click Insert -> Function... 5. In the Paste Function dialog box, in the Function Category list, click Financial. In the Function Name list, double-click FV and move the FV window so you can see the values on the worksheet 6. Click the box to the right of Rate and, on the worksheet, click cell C5 and type /12 7. In the FV window, click the box to the right of Nper and, on the worksheet, click cell C7 8. In the FV window, click the box to the right of Pmt and type 9. On the worksheet, click cell C6 10. In the FV window, click the box to the right of Pv and type 11. On the worksheet, click cell C4 12. Since this is a loan, the payments are expected at the end of the month. Therefore, in the FV window, click the box to the right of Type and type 0
123
13. Click OK
The PMT() function is used to calculate the regular payment of loan or an investment. Its syntax is: PMT(Rate, NPeriods, PresentValue, FutureValue, PaymentType) In the following example, a customer is applying for a car loan. The cost of the car will be entered in cell C4. It will be financed at a rate entered in cell C6 for a period set in cell C7. The dealer estimates that the car will have a value of $0.00 when it is paid off. 1. Double-click Sheet3 to put it in edit mode. Type Payments Amount and press Enter 2. Complete the worksheet as follows
3. Click cell C8 and type =PMT( 4. Click cell C6 and type /12, 5. Click cell C7 and type ,6. Click cell C4 and type , 7. Click cell C5 8. Type ,0) and, on the Formula Bar, click the Enter button
125
9. Suppose that, during the evaluation, a customer decides that she doesn't need a brand new car anymore. Also, she thinks that a 5-year car loan is too long. Furthermore, she wants to make a $4500.00 down payment to reduce the monthly payments. On the other side of the desk, the salesperson who wants to make a juicy commission on this loan has decided to increase the interest rate. Change the new values of the worksheet as follows and see the result
10. Save
the
workbook
function calculates. Suppose a customer is applying for a car loan and the salesperson decides (or agrees with the customer) that the loan will be spread over 5 years (5 years * 12 months each = 60 months). The salesperson then applies a certain interest rate. The IPMT() function can help you calculate the amount of interest that the lending institution would earn during a certain period. In essence, you can use it to know how much money the company would earn in the 3rd year, or in the 4th year, or in the 1st year. Based on this, this function has an argument called Period, which specifies the year you want to find out the interest earned in. The syntax of the IPMT() function is: IPMT(Rate, Period, NPeriods, PresentValue, FutureValue, PaymentType) The Rate argument is a fixed percent value applied during the life of the loan. The PresentValue is the current value of the loan or investment. It could be the marked value of the car, the current mortgage value of a house, or the cash amount that a bank is lending. The FutureValue is the value the loan or investment will have when the loan is paid off. The NPeriods is the number of periods that occur during the lifetime of the loan. For example, if a car is financed in 5 years, this value would be (5 years * 12 months each =) 60 months. When passing this argument, you must remember to pass the right amount. The Period argument represents the payment period. For example, it could be 3 to represent the 3rd year of a 5 year loan. In this case, the IPMT() function would calculate the interest earned in the 3rd year only. The PaymentType specifies whether the periodic (such as monthly) payment of the loan is made at the beginning (1) or at the end (1) of the period. The FutureValue and the PaymentType arguments are not required.
1. To add a new worksheet, on the main menu, click Insert -> Worksheet 2. Double-click the new Sheet1 tab to put it in edit mode. Type Periodic Interest Earned and press Enter 3. Move the new worksheet to be the most right 4. Complete the worksheet as follows
127
5. Click cell C9 and type =IPMT( 6. Click cell C5 and type /12, 7. Click cell C6 and type , 8. Click cell C7 and type ,9. Click cell C4 and type , 10. Click cell C8 and type , 11. Type ,0) and, on the Formula Bar, click the Enter button
12. Save the workbook While the IPMT() function calculates the amount paid as interest for a period of a loan or an investment, the PPMT() function calculates the actual amount that applies to the balance of the loan. This is referred to as the principal. Its syntax is: 128
PPMT(Rate, Period, NPeriods, PresentValue, FutureValue, PaymentType) The arguments are the same as described in the previous sections.
1. Change
the
Periodic
Interest
Earned
worksheet
as
follows
2. Click cell C10 and type =PPMT( 3. Click cell C5 and type /12, 4. Click cell C6 and type , 5. Click cell C7 and type ,6. Click cell C4 and type , 7. Click cell C8 and type , 8. Type ,0) and, on the Formula Bar, click the Enter button
129
All of the arguments are the same as described for the other functions, except for the Guess. This argument allows you to give some type of guess for a rate. This argument is not required. If you omit it, its value is assumed to be 10. 1. To add a new worksheet, on the main menu, click Insert -> Worksheet 2. Double-click the new Sheet1 tab to put it in edit mode. Type Interest Rate and press Enter 3. Move the new worksheet to be the most right 4. Change the Interest Rate worksheet as follows
5. Click cell C8 and type =-RATE( 6. Click cell C7 and type , 7. Click cell C6 and type ,8. Click cell C4 and type , 9. Click cell C5 and type ,0)*12 and, on the Formula Bar, click the Enter button
131
10. To use the ABS() function, change the function in cell C14 to =ABS(RATE(C7,C6,-C4, C5, 0)*12) and press Enter 11. Save the workbook
4. Change
the
worksheet
as
follows
5. Click cell D12 and type =IRR( 6. Select cells D4:D10 and, on the Formula Bar, click the Enter button
133
7. In cell D11, type 12 and click cell D12 8. In the Formula Bar, change the function to =IRR(D4:D10, D11) and press Enter (you shouldn't need any significant difference unless you change the range of cells such as D4:D8) 9. Save the workbook
134
5. Click cell C14 and type =-NPV( 6. Click cell C13 and type , 7. Select cells C4:C12 and, on the Formula Bar, click the Enter button
135
8. To use the ABS() function, change =ABS(NPV(C13,C4:C12)) and press Enter 9. Save the workbook
the
function
in
cell
C14
to
136
Logical Function
A logical function is one that evaluates an expression and returns a Boolean result. For example, imagine you have a series of cells that represent employees last name. If you are interested to know what cell doesn't have a value (a last name), you can use a function. On the other hand, imagine you have a cell that is supposed to indicate whether an item must receive a discount, you can use a conditional function to check it. Most, if not all, logical functions check a condition and render a result. The condition is also called a criterion. A criterion can be something like "Check if the cell contains Male", or "Check if the salary is less than $12.35".
IF
To check whether a criterion is true or false before taking a subsequent action, you can use the IF() function. Its syntax is: IF(ConditionToTest, WhatToDoIfConditionIsTrue, WhatToDoIfConditionIsFalse) When it is called, the IF() function checks the truthfulness or negativity of the ConditionToTest argument. If the result is true, then it will execute the first expression, WhatToDoIfConditionIsTrue in our syntax. If the result is false, it will consider the second option, the WhatToDoIfConditionIsFalse parameter in our syntax.
Nested IF
The IF() function we have introduced above is used to check one condition and then take one or the other action. In some cases, you will need to check more than one condition. In other words, you may want to check a first condition. If that condition is false, you may want to yet check another condition. The pseudo-code used for such a scenario is: e.g =IF(B14>16.5,"A",IF(B14>14.5,"B",IF(B14>12.5,"C",IF(B14>12,"D","F"))))
VLOOKUP
Searches for a value in the first column of a table array and returns a value in the same row from another column in the table array. The V in VLOOKUP stands for vertical. Use VLOOKUP instead of HLOOKUP when your comparison values are located in a column to the left of the data that you want to find. =VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) Lookup_value The value to search in the first column of the table array (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.). Lookup_value 137
can be a value or a reference. If lookup_value is smaller than the smallest value in the first column of table_array, VLOOKUP returns the #N/A error value. Two or more columns of data. Use a reference to a range or a range name. The values in the first column of table_array are the values searched by lookup_value. These values can be text, numbers, or logical values. Uppercase and lowercase text are equivalent.
Table_array
The column number in table_array from which the matching value must be returned. A col_index_num of 1 returns the value in the first column in table_array; a col_index_num of 2 returns the value in the second column in table_array, and so on. If col_index_num is: Less than 1, VLOOKUP returns the #VALUE! error value.
Col_index_num Greater than the number of columns in table_array, VLOOKUP returns the #REF! error value.
A logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match: If TRUE or omitted, an exact or approximate match is returned. If an exact match is not found, the next largest value that is less than lookup_value is returned. The values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP may not give the correct value. You can put the values in ascending order by choosing the Sort command from the Data menu and selecting Ascending. For more information, see Default sort orders. If FALSE, VLOOKUP will only find an exact match. In this case, the values in the first column of table_array do not need to be sorted. If there are two or more values in the first column of table_array that match the lookup_value, the first value found is used. If an exact match is not found, the error value #N/A is returned.
Range_lookup
Remarks When searching text values in the first column of table_array, ensure that the data in the first column of table_array does not have leading spaces, trailing spaces, inconsistent use of straight ( ' or " ) and curly ( or ) quotation marks, or nonprinting characters. In these cases, VLOOKUP may give an incorrect or unexpected value. For more information on functions that you can use to clean text data, see Text and Data functions When searching number or date values, ensure that the data in the first column of table_array is not stored as text values. In this case, VLOOKUP may give an incorrect or unexpected value. For more information, see Convert numbers stored as text to numbers. If range_lookup is FALSE and lookup_value is text, then you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.
138
A 1 2 3 4 5 6 7 8 9 10 Density 0.457 0.525 0.616 0.675 0.746 0.835 0.946 1.09 1.29 Formula =VLOOKUP(1,A2:C10,2)
B Viscosity 3.55 3.25 2.93 2.75 2.57 2.38 2.17 1.95 1.71 Description (result) Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A which is 0.946, and then returns the value from column B in the same row. (2.17) Using an approximate match, searches for the value 1 in column A, finds the largest value less than or equal to 1 in column A, which is 0.946, and then returns the value from column C in the same row. (100) Using an exact match, searches for the value .7 in column A. Because there is no exact match in column A, an error is returned. (#N/A) Using an approximate match, searches for the value 0.1 in column A. Because 0.1 is less than the smallest value in column A, an error is returned. (#N/A) Using an approximate match, searches for the value 2 in column A, finds the largest value less than or equal to 2 in column A, which is 1.29, and then returns the value from column B in the same row. (1.71)
=VLOOKUP(1,A2:C10,3,TRUE )
=VLOOKUP(.7,A2:C10,3,FAL SE)
=VLOOKUP(0.1,A2:C10,2,TR UE)
=VLOOKUP(2,A2:C10,2,TRUE )
139
HLOOKUP
Searches for a value in the top row of a table or an array (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.) of values, and then returns a value in the same column from a row you specify in the table or array. Use HLOOKUP when your comparison values are located in a row across the top of a table of data, and you want to look down a specified number of rows. Use VLOOKUP when your comparison values are located in a column to the left of the data you want to find. =HLOOKUP(lookup_value,table_array,row_index_num,range_lookup) Lookup_value is the value to be found in the first row of the table. Lookup_value can be a value, a reference, or a text string. Table_array is a table of information in which data is looked up. Use a reference to a range or a range name. The values in the first row of table_array can be text, numbers, or logical values. If range_lookup is TRUE, the values in the first row of table_array must be placed in ascending order: ...-2, -1, 0, 1, 2,... , A-Z, FALSE, TRUE; otherwise, HLOOKUP may not give the correct value. If range_lookup is FALSE, table_array does not need to be sorted. Uppercase and lowercase text are equivalent. You can put values in ascending order, left to right, by selecting the values and then clicking Sort on the Data menu. Click Options, click Sort left to right, and then click OK. Under Sort by, click the row in the list, and then click Ascending. Row_index_num is the row number in table_array from which the matching value will be returned. A row_index_num of 1 returns the first row value in table_array, a row_index_num of 2 returns the second row value in table_array, and so on. If row_index_num is less than 1, HLOOKUP returns the #VALUE! error value; if row_index_num is greater than the number of rows on table_array, HLOOKUP returns the #REF! error value. Range_lookup is a logical value that specifies whether you want HLOOKUP to find an exact match or an approximate match. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, HLOOKUP will find an exact match. If one is not found, the error value #N/A is returned. 140
Remarks
1. 2. 3.
If HLOOKUP can't find lookup_value, and range_lookup is TRUE, it uses the largest value that is less than lookup_value. If lookup_value is smaller than the smallest value in the first row of table_array, HLOOKUP returns the #N/A error value. If range_lookup is FALSE and lookup_value is text, you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
A 1 2 3 4 Axles 4 5 6 Formula =HLOOKUP("Axles",A1:C4,2,TRUE) B Bearings 4 7 8 Description (Result) Looks up Axles in row 1, and returns the value from row 2 that's in the same column. (4) Looks up Bearings in row 1, and returns the value from row 3 that's in the same column. (7) Looks up B in row 1, and returns the value from row 3 that's in the same column. Because B is not an exact match, the next largest value that is less than B is used: Axles. (5) Looks up Bolts in row 1, and returns the value from row 4 that's in the same column. (11) Looks up 3 in the first row of the array constant, and returns the value from row 2 in same column. (c) C Bolts 9 10 11
=HLOOKUP("Bearings",A1:C4,3,FALSE)
=HLOOKUP("B",A1:C4,3,TRUE)
=HLOOKUP("Bolts",A1:C4,4)
=HLOOKUP(3, {1,2,3;"a","b","c";"d","e","f"},2,TRUE)
141
Index
Returns a value or the reference to a value from within a table or range. There are two forms of the INDEX function: the array (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.) form and the reference form. Array form Returns the value of an element in a table or an array (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.), selected by the row and column number indexes. =INDEX(array,row_num,column_num) is a range of cells or an array constant. If array contains only one row or column, the corresponding row_num or column_num argument is optional. If array has more than one row and more than one column, and only row_num or column_num is used, INDEX returns an array of the entire row or column in array.
Array
selects the row in array from which to return a value. If row_num is omitted, column_num is required.
Row_num
selects the column in array from which to return a value. If column_num is omitted, row_num is required.
Column_num
Remarks If both the row_num and column_num arguments are used, INDEX returns the value in the cell at the intersection of row_num and column_num. If you set row_num or column_num to 0 (zero), INDEX returns the array of values for the entire column or row, respectively. To use values returned as an array, enter the INDEX function as an array formula (array formula: A formula that performs multiple calculations on one or more sets of values, and then returns either a single result or multiple results. Array formulas are enclosed between braces { } and are entered by pressing CTRL+SHIFT+ENTER.) in a horizontal range of cells for a row, and in a vertical range of cells for a column. To enter an array formula, press CTRL+SHIFT+ENTER. Row_num and column_num must point to a cell within array; otherwise, INDEX returns the #REF! error value.
142
1.
Auditing Mode.
A B Data Lemons Pears Description (Result) Value at the intersection of the second row and second column in the range (Pears) Value at the intersection of the second row and first column in the range (Bananas)
1 2 3
Example 2
1.
Auditing Mode.
A B Description (Result) Value in the first row, second column in the array constant (2) Value in the second row, second column in the array constant (4)
1 2 3
Formula =INDEX({1,2;3,4},0, 2)
Reference form Returns the reference of the cell at the intersection of a particular row and column. If the reference is made up of nonadjacent selections, you can pick the selection to look in. =INDEX(reference,row_num,column_num,area_num) is a reference to one or more cell ranges.If you are entering a nonadjacent range for the reference, enclose reference in parentheses. If each area in reference contains only one row or column, the row_num or column_num argument, respectively, is optional. For example, for a single row reference, use INDEX(reference,,column_num).
Reference Row_num
is the number of the row in reference from which to return a reference. is the number of the column in reference from which to return a reference. 143
Column_num
selects a range in reference from which to return the intersection of row_num and column_num. The first area selected or entered is numbered 1, the second is 2, and so on. If area_num is omitted, INDEX uses area 1.
Area_num
144
Remarks After reference and area_num have selected a particular range, row_num and column_num select a particular cell: row_num 1 is the first row in the range, column_num 1 is the first column, and so on. The reference returned by INDEX is the intersection of row_num and column_num. If you set row_num or column_num to 0 (zero), INDEX returns the reference for the entire column or row, respectively. Row_num, column_num, and area_num must point to a cell within reference; otherwise, INDEX returns the #REF! error value. If row_num and column_num are omitted, INDEX returns the area in reference specified by area_num. The result of the INDEX function is a reference and is interpreted as such by other formulas. Depending on the formula, the return value of INDEX may be used as a reference or as a value. For example, the formula CELL("width",INDEX(A1:B2,1,2)) is equivalent to CELL("width",B1). The CELL function uses the return value of INDEX as a cell reference. On the other hand, a formula such as 2*INDEX(A1:B2,1,2) translates the return value of INDEX into the number in cell B1.
Auditing Mode.
A 1 2 3 4 5 6 7 8 9 10 11 Almonds Cashews Peanuts Walnuts Formula =INDEX(A2:C6,2,3) 2.80 3.55 1.25 1.75 Description (Result) The intersection of the second row and third column in the range A2:C6, which is the content of cell C3. (38) The intersection of the second row and second column in the second area of A8:C11, which is the 10 16 20 12 Fruit Apples Bananas Lemons Oranges Pears B Price 0.69 0.34 0.55 0.25 0.59 C Count 40 38 15 25 40
=INDEX((A1:C6,A8:C11),2,2 ,2)
145
content of cell B9. (3.55) =SUM(INDEX(A1:C11,0,3,1) ) =SUM(B2:INDEX(A2:C6,5,2) ) The sum of the third column in the first area of the range A1:C11, which is the sum of C1:C6. (216) The sum of the range starting at B2, and ending at the intersection of the fifth row and the second column of the range A2:A6, which is the sum of B2:B6. (2.42)
Match
Returns the relative position of an item in an array (array: Used to build single formulas that produce multiple results or that operate on a group of arguments that are arranged in rows and columns. An array range shares a common formula; an array constant is a group of constants used as an argument.) that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself. =MATCH(lookup_value,lookup_array,match_type)
Lookup_value
is the value you use to find the value you want in a table.
Lookup_value is the value you want to match in lookup_array. For example, when you look up someone's number in a telephone book, you are using the person's name as the lookup value, but the telephone number is the value you want. Lookup_value can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value. is a contiguous range of cells containing possible lookup values. Lookup_array must be an array or an array reference.
Lookup_array
is the number -1, 0, or 1. Match_type specifies how Microsoft Excel matches lookup_value with values in lookup_array.
Match_type
If match_type is 1, MATCH finds the largest value that is less than or equal to lookup_value. Lookup_array must be placed in ascending order: ...-2, -1, 0, 1, 2, ..., AZ, FALSE, TRUE. If match_type is 0, MATCH finds the first value that is exactly equal to lookup_value. Lookup_array can be in any order. If match_type is -1, MATCH finds the smallest value that is greater than or equal to lookup_value. Lookup_array must be placed in descending order: TRUE, FALSE, Z-A, ...2, 1, 0, -1, -2, ..., and so on. If match_type is omitted, it is assumed to be 1.
146
Remarks MATCH returns the position of the matched value within lookup_array, not the value itself. For example, MATCH("b",{"a","b","c"},0) returns 2, the relative position of "b" within the array {"a","b","c"}. MATCH does not distinguish between uppercase and lowercase letters when matching text values. If MATCH is unsuccessful in finding a match, it returns the #N/A error value. If match_type is 0 and lookup_value is text, you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.
A 1 2 3 4 5 Product Bananas Oranges Apples Pears Formula =MATCH(39,B2:B5, 1) =MATCH(41,B2:B5, 0) =MATCH(40,B2:B5,1) B Count 25 38 40 41 Description (Result) Because there is not an exact match, the position of the next lowest value (38) in the range B2:B5 is returned. (2) The position of 41 in the range B2:B5. (4)
Returns an error because the range B2:B5 is not in descending order. (#N/A)
147
Using Excel as a database makes it a far more powerful tool than just using it as a spreadsheet. In order to benefit from Excels neat database capabilities, you need to properly set up the information on your spreadsheet as a database, as described above. If you dont, you will not be able to perform database tasks. For example, make sure the column labels of your database are consecutive and you dont skip any columns and end up with columns with no column labels within your database. Similarly make sure you dont have totally blank rows within your database. If you do, this would break up your database and the database tasks you perform will only apply to a part of your database, resulting in erroneous reports. It is OK to have some blank cells in a row but it is not OK to have a row that has no information in any of its cells. When you work with large amounts of data, scrolling up, down, right and left will only create frustration for you and will never give you any useful information. By using Excel database functions, literally, in a matter of seconds you can turn a large quantity of raw data into a meaningful, good looking, useful report. It is easier than you might imagine. You can always start with a list and add fields to it. All it takes is to type in a column label in a column adjacent to your database (without skipping any columns) and enter your additional information in that column. Or you may insert a column in your database and use it as the additional field by typing a column heading. The main Excel database tasks are sorting, subtotaling, filtering and the most powerful of all is pivot tables. All these features are covered in this manual.
seems to be deleting the sheet which contains your pivot table and start over by creating a new pivot table, which usually takes only a few seconds. Note: There is no limit, other than available memory, to the number of pivot tables that can be defined in the same workbook-or even on the same worksheet. The following table is a sample report which shows summarized expense for three fiscal years by type of expense. In a matter of seconds hundreds of rows of detail data get summarized as shown below using the power of pivot tables.
You can even make the report look nice as follows, using Autoformat which is also explained in this manual on page 34:
149
Make sure you pick one cell in the body of your database, meaning any cell below the column labels where there is data. Excel will recognize the boundaries of your database.
PivotTable Wizard Step 1 of 3 On the menu bar click on Data, then click on Pivot Table and PivotChart Report, select the first option which is Microsoft Excel list or Database and click on Next. PivotTable Wizard Step 2 of 3 Since your cell pointer was in the body of the database, Excel automatically knows the range of your database. Here, just click Next. PivotTable Wizard Step 3 of 3 Click on Layout which is button to the left. Here is the heart of the pivot table where you get to design your report. Every field of your database appears as a button to the right. Simply drag the field(s) that you want your data summarized by to the Row and/or Column areas. Hit OK and then hit Finish. Keep in mind that the following are just examples. You can just as easily summarize your reports by other fields that are of more interest to you. Also, Excel automatically includes grand totals and subtotals in the pivot table, so remove any subtotals from your list by choosing Data from the menu bar, then Subtotals and click on Remove All. Otherwise, pivot table will not allow you to proceed through the final step and you will get an error message. Setting up the Layout Area 150
Drag the field Sub Code (on the right side of screen) to the ROW area (left side of screen). Then drag the Fiscal Year field to the COLUMN area. Then drag the numeric field Expense from the right side of the screen to the DATA area.
Double-click here
Remember that the DATA area contains the fields you want summarized. If instead of Sum it defaults to Count, double click on Count of Expense and choose Sum as shown below and click OK.
151
When done, click OK. Here is the result of your pivot table. The pivot table is created on a new sheet in the workbook.
You can rename the sheet that contains the pivot table by double clicking on the sheet tab name and typing your new meaningful sheet name. When you create a pivot table, the Pivot Table toolbar will appear on your screen and it looks like this:
If you dont see this toolbar then you can choose the Toolbar command from the View menu and choose PivotTable. The best way to learn about pivot tables is through experimenting. Try positioning each field which is represented by buttons as a row category, column category, and page the pivot table will reveal different information about the underlying data with each layout.
152
153
154
This will sum the expenses by Sub-Object Title for each Project When done, click on OK. You will get this report.
155
156
Notice cell B1 on your finished report where the word All is. This means you are looking at All the projects. Click on the down arrow next to all and you will see a list of the different projects to pick from and hit OK.
157
The figure below shows just the project2 expenses. Notice how the numbers have changed from the previous report. Select some other projects, again click on cell B1 to choose another project and watch the numbers change.
Keep in mind you can have more than one field in the Page area. The more page fields you have, the more filtered the data is on a page. For example, a pivot table with the single page field Project shows total expenses for only one project at a time. Adding the page field Sub-Object Title filters the data even more by displaying total expense data only for the selected sub-object title for the selected project.
158
Depending on your layout, there can be more than one page field. The Show Pages dialog box is displayed, letting you select which field will determine the page breaks.
3. Select Project from the list, and click OK. The following figure shows the result.
Notice that three new worksheets have been inserted into the workbook one for each project.
3 new worksheets
159
The following steps will show you how to create such a report. Lets say you are working with detail payroll data for 3 months. Issue the Pivot Table command from the Data menu to get to the ayout screen as shown below.
160
Double-click on the Sum of Time to create a custom calculation. Once you see the top section of the screen below, click on Options. Then click on the arrow next to the Show data as box and set that option as % of column.
Click OK, then OK and you will get the report that we just saw with percentages in all columns. However, at first it will be for the whole department. Click on the arrow next to Cell B1 to pick one employee at a time. Custom calculations for PivotTable data fields The following functions are available for custom calculations in data fields. If you want to create a formula to work with PivotTable data, you can create a calculated field or a calculated item. Function Difference From Result
Displays all the data in the data area as the difference from the value for the specified Base field and Base item. The base field and base item provide the data used in the custom calculation. % Of Displays all the data in the data area as a percentage of the value for the specified Base field and Base item. The base field and base item provide the data used in the custom calculation. 161
% Difference From
Displays all the data in the data area as the difference from the value for the specified Base field and Base item, but displays the difference as a percentage of the base data. The base field and base item provide the data used in the custom calculation. Displays the data for successive items as a running total. You must select the field for which you want to show the items in a running total. Displays the data in each row as a percentage of the total for each
Displays all the data in each column as a percentage of the total for each column. % of total Displays the data in the data area as a percentage of the grand total of all the data in the PivotTable. Index Displays the data by using the following calculation:((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total))
162
If for some reason you need to sort in reverse alphabetical order of type of expense, pick a cell in the Sub-Object Title column and click on the icon.
163
164
Your new report will not include funds 182XX and 19900. To include them again, click on the arrow next to fund heading again and check funds 182XX and 19900. Caution: if you redesign your report and dont include the Fund field in your report, even though you have indicated to hide 2 funds, the instruction to hide will be ignored and they will be included in your total amounts.
Suppressing Subtotals
Sometimes you may want your summarized report to have two descriptive fields for a particular numeric field. For example, you may want to summarize your payroll data by person and see employee name, as well as employee number and total gross salary. If you layout your pivot table as follows:
165
166
The reason we dont like this report, is that it gives subtotals by Employee Name as well as by Employee ID and we only need one. We dont want the lines that say Total next to the employee name. In other words, we want to suppress subtotals by Employee Name. To accomplish this, double click on the button that says Name. Once you see the following screen,
click on None for Subtotals. Click OK and you will get the following report:
Copy Paste Special Value a Pivot Table Report Since a pivot table maintains a link to the source data, you cannot directly edit the data area of a pivot table. To convert a pivot table to a worksheet range that you can edit, copy the pivot table using the Copy command on the Edit menu (or the shortcut right 167
mouse button). Then paste it into a new location using the Paste Special command on the Edit menu (or the shortcut right mouse button). Select the Values option button in the Paste Special dialog box and click OK. You can use this feature to use a large amount of raw data, build a pivot table, perform copy-paste special-value on it and basically create a new simpler database with summarized data and now use this database as source for a further summarized and rolled up pivot table report. An example to help illustrate this concept is as follows: We have pulled down payroll report for our entire department for 3 months. We simply need to know the average benefit rate for each employee for this time period. To calculate that, we need to divide total benefit amount by total gross earnings by employee to get the average benefit rate. First run a pivot report by employee for gross earnings only. Click on A1 to select the entire pivot table report. On the menu bar click on Edit, then Copy.
Go to a new sheet, select A1. On the menu bar click on Edit, then select Paste Special. In the Paste Special Dialog Box, click on Values, then click OK.
168
You will simply get a list of employees and their total gross salary, without it being a pivot table any more. Now go back to redesign your pivot table report. Remove Sum of Gross Earnings and drag Total Benefits to the Data area. Perform the same copypaste special-value as just described. However, instead of pasting in cell A1, paste special in cell C1. After formatting the numbers, this is what it will look like:
Adjust the headings to say Total Salary and Total Benefits. After verifying that the names are properly lined up, delete column C because you already have the names in column A. (Delete the last line of your data which indicates the Grand Total). Now you can add a formula in the last column, dividing total benefits by total gross. REMEMBER to give this new column a heading, i.e. Benefit rate, so that it becomes an integral part of your newly created database. Format this last column to percentages. You now have a new database showing average of actual benefit rates of all your employees based on three months of payroll data!
169
Or click the field button in your pivot table report the button text displays on the formula bar. Use the formula bar to edit the text, just as you would edit the contents of a cell. (Or, double-click the field button in your pivot table, and change the Name in the Pivot Table Field dialog box). Using Form to facilitate Viewing and Editing Excel Database
170
Macro Tips Accessing the Record New Macro Command Creating & Recording a New Macro Running a Macro Suspending a Macro Deleting a Macro Advanced Macros
Macro Tips
As you are creating a macro, you will be requested to assign a name to the macro and to indicate where the macro will be stored. The following guidelines and tips can help you make the best decision.
Naming a Macro
Macro names must:
begin with a letter contain no spaces contain no special characters (e.g., @, %, &, ^) have the appropriate name from the following list to run automatically:
171
AutoExec the macro runs when Excel is opened AutoExit AutoOpe n AutoNew the macro runs when you exit Excel the macro runs when you open a worksheet the macro runs when you create a new worksheet
AutoClose the macro runs when you close the current worksheet
Saving a Macro
A macro is saved as part of a template. If the use of the macro is limited to specific types of worksheets and you have a template for that type of worksheet, it should be stored in that template.
Assigning Macros
While it is not required to assign a macro to a second location, doing so can make the macro easier to use and save more time. Depending on your personal style of working with Excel, you may want to assign the macro to a keystroke combination, a menu, or a toolbar. You can assign the macro to all three if you want.
Recording Notes
Macros can be created by recording keystrokes (not mouse actions like selecting text) or by writing the macro using the Visual Basic programming language. This document focuses on macros that can be created through the recording method. WARNING: If you are working with a multi-layer dialog box (one with tabs at the top), only the changes on the current tab are recorded when you click OK. If you want to record changes on more than one layer, you will need to access the dialog box once for each layer, clicking OK as you complete the changes on that layer.
If you would prefer to have the Record New Macro command available on a toolbar, follow the instructions: Windows: 1. From The the View menu, Customize select dialog Toolbars box Customize... appears.
2. Select the Commands tab 3. From the Categories scroll box, select Tools 4. From the Commands scroll box, click and drag MACROS... and RECORD NEW MACRO... to the Standard toolbar NOTE: You may only click and drag one command to the toolbar at a time. 5. Click CLOSE 6. On the Standard toolbar, click RECORD MACRO... The Record Macro dialog appears. Macintosh:
173
1. From the View menu, select Toolbars Customize Toolbars/Menus... The Customize Toolbars/Menus dialog box appears.
2. Select the Commands tab 3. From the Categories scroll box, select Tools 4. From the Commands scroll box, click and drag MACROS... and RECORD NEW MACRO... to the Standard toolbar NOTE: You may only click and drag one command to the toolbar at a time. 5. Click OK 6. On the Standard toolbar, The Record Macro dialog appears. click RECORD MACRO...
174
2. In the Macro name text box, type the name for the new macro NOTE: For information on naming conventions, refer to Naming a Macro. 3. OPTIONAL: In the Shortcut key text box, type a letter that can be used to activate the macro 4. OPTIONAL: In the Description text box, type a short narrative description for the macro 5. From the Store macro in pull-down list, select the appropriate option NOTE: For more information, refer to Saving a Macro. 6. Click OK The Macro Record toolbar appears in the window with your document.
7. Perform the activity that you want the macro to accomplish 8. When done, on the Macro Record toolbar, click STOP RECORDING OR From the Tools menu, select Macro Stop Recording The macro is saved as part of the template you chose. 9. Continue with Running a Macro
Running a Macro
We recommend that you save your file before running the macro. Then, if the results are undesirable you can close the file without saving it and reopen the version that was saved just prior to running the macro.
Suspending a Macro
If you are running a macro and need to stop it, you may do so. 1. Press [Esc] 2. In the Microsoft Visual Basic dialog box, click END
Deleting a Macro
WARNING: If you delete a macro, it will be removed from the template and will not be available to any workbook. 1. From the Tools menu, select Macro Macros OR On the Standard toolbar, click RUN MACRO The Macro dialog box appears. HINT: If the Run Macro button does not appear on the Standard toolbar, follow steps 1-5 in Accessing the Record New Record: Toolbar. 2. From the Macro name scroll box, select the macro you want to delete 3. Click DELETE A confirmation dialog box appears. 4. Click YES NOTE: Deleting a macro does not remove the effects of the macro once it has been run; it makes the macro unavailable for future use. 5. Repeat steps 2-4 until all the unwanted macros are deleted
Advanced Macros
Interactive Macros Some macros allow you to ask the user for input. In order to do this, you need to work with the Visual Basic programming language. Editing a Macro The editing of macros requires some programming knowledge. Simple macros are often easier to recreate than edit.
176