Docsity

Essential Spreadsheet Operations - Lecture Notes | FOR 240, Study notes of Forestry

Toggle sidebar
bg1
FOR 240 Introduction to Computing in Natural Resources
6. Essential Spreadsheet Operations
6.1 Working with Worksheets
When you open a new workbook in Excel, the workbook has a designated number
of worksheets in it. You can specify how many sheets each new workbook will contain.
By default, this number of worksheets is three. Although empty worksheets really don’t
use much additional memory or disk storage space, they just get in the way. And besides,
adding a new worksheet when you need one is easy. I strongly recommend that you
change the default value to one worksheet. To do so, select Tools -> Options, select the
General tab, and then change the Sheets in new workbook setting to one (Figure 1). After
doing this, all new workbooks will have a single worksheet.
Figure 1. Dialog box of options.
(1) Adding a New Worksheet
The following are three ways to add a new worksheet to a workbook:
o Select the Insert -> Worksheet command
o Press Shift+F11
o Right-click a sheet tab, choose the Insert command from the shortcut
menu, and then select Worksheet from the Insert dialog box.
(2) Deleting a Worksheet
Essential Spreadsheet Operations, Prepared by Dr. Jingxin Wang 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Essential Spreadsheet Operations - Lecture Notes | FOR 240 and more Study notes Forestry in PDF only on Docsity!

6. Essential Spreadsheet Operations

6.1 Working with Worksheets

When you open a new workbook in Excel, the workbook has a designated number of worksheets in it. You can specify how many sheets each new workbook will contain. By default, this number of worksheets is three. Although empty worksheets really don’t use much additional memory or disk storage space, they just get in the way. And besides, adding a new worksheet when you need one is easy. I strongly recommend that you change the default value to one worksheet. To do so, select Tools -> Options, select the General tab, and then change the Sheets in new workbook setting to one (Figure 1). After doing this, all new workbooks will have a single worksheet.

Figure 1. Dialog box of options.

(1) Adding a New Worksheet

The following are three ways to add a new worksheet to a workbook: o Select the Insert -> Worksheet command o Press Shift+F o Right-click a sheet tab, choose the Insert command from the shortcut menu, and then select Worksheet from the Insert dialog box.

(2) Deleting a Worksheet

If you no longer need a worksheet, or if you want to get rid of an empty worksheet in a workbook, you can delete it in either of two ways:

o Select the Edit -> Delete Sheet command o Right-click the sheet tab and choose the Delete command from the shortcut menu.

(3) Changing the Name of a Worksheet

Excel uses default names for worksheets: Sheet1, Sheet2, and so on. Providing more meaningful names for your worksheets is usually a good idea. To change a sheet’s name, use any of the following methods:

o Choose Format -> sheet -> Rename o Double-click the sheet tab o Right-click the sheet tab and choose the Rename command from the shortcut menu

In any of these cases, Excel highlights the name on the sheet tab so that you can edit the name or replace it with a new name. Sheet names can be up to 31 characters, and spaces are allowed. However, you can’t use the following characters in sheet names: : colon / slash \ backslash ? question mark

  • asterisk

(4) Moving a Worksheet

Sometimes, you may want to rearrange the order of worksheets in a workbook. If you have a separate worksheet for each sales region, for example, arranging the worksheets in alphabetical order or by total sales might be helpful. You also may want to move a worksheet from one workbook to another (to move a worksheet to a different workbook, both workbooks must be open). You can move a worksheet in either of two ways:

o Select the Edit -> Move or Copy Sheet command. This command is also available when you right-click a sheet tab. o Click the sheet tab and drag it to its desired location (either in the same workbook or in a different workbook). When you drag, the mouse pointer changes to a small sheet and a small arrow guides you.

Dragging is often the easiest method, but if the workbook has many sheets, you may prefer to use the menu command. This command displays the dialog box shown in Figure 2, which enables you to select the workbook and the new location.

As you add more information to a worksheet, you may find that it gets more difficult to navigate and locate what you want. Excel includes a few options that enable you to view your sheet, and sometimes multiple sheets, more efficiently.

Multiple views:

Sometimes, you may want to view two different parts of a worksheet simultaneously. Or, you may want to examine more than one sheet in the same workbook simultaneously. You can accomplish either of these actions by opening a new view to the workbook, using one or more additional windows.

To create a new view of the active workbook, choose Window -> New Window. Excel displays a new window with the active workbook, similar to Figure 3. Notice the text in the windows’ title bars: Charlie.xls:1 and Charlie.xl s: 2.

To help you keep track of the windows, Excel appends a colon and a number to each window. A single workbook can have as many views (that is, separate windows) as you want. Each window is independent of the others. In other words, scrolling to a new location in one window doesn’t cause scrolling in the other window(s). This also enables you to display a different worksheet in a separate window. Figure 4 shows three views in the same workbook. Each view displays a different worksheet.

Figure 3. Two views of the same workbook.

Figure 4. Three worksheets in the same workbook.

Splitting Panes:

If you prefer not to clutter your screen with additional windows, Excel provides another option for viewing multiple parts of the same worksheet. The Window -> Split command splits the active worksheet into two or four separate panes. The split occurs at the location of the cell pointer. You can use the mouse to drag the individual panes to resize them.

Figure 5 shows a worksheet split into four panes. Notice that row numbers and column letters aren’t continuous. In other words, splitting panes enables you to display in a single window widely separated areas of a worksheet. The two top-to-bottom stacked panes always have the same column headings, and the two side-by-side panes always have the same row headings. To remove the split panes, choose Window -> Remove Split.

Another way to split and unsplit panes is to drag either the vertical or horizontal split bar; when you move the mouse pointer over a split bar, the mouse point changes to a pair of parallel lines with arrows pointing outward from each line. Figure 6 shows where these split bars are located. To remove split panes by using the mouse, drag the pane separator all the way to the edge of the window, or just double-click it.

Freezing Panes:

Many worksheets, such as the one shown in Figure 7, are set up with row and column headings. When you scroll through such a worksheet, you can easily get lost when the row and column headings scroll out of view, as demonstrated in Figure 7. Excel provides a handy solution to this problem: freezing panes.

Figure 7. A worksheet with frozen row heading.

6.2 Working with Cells and Ranges

A cell is a single element in a worksheet that can hold a value, text, or a formula. A cell is identified by its addres s , which consists of its column letter and row number. For example, cell D12 is the cell in the fourth column and the twelfth row.

A group of cells is called a rang e. You designate a range address by specifying its upper-left cell address and its lower-right cell address, separated by a colon. Here are some examples of range addresses:

A1:B1 Two cells that occupy one row and two columns C24 A range that consists of a single cell A1:A100 100 cells in column A A1:D4 16 Cells (four rows by four columns) C1:C65536 An entire column of cells; this range also can be expressed as C:C A6:IV6 An entire row of cells; this range also can be expressed as 6: A1:IV65536 All cells in a worksheet

(1) Selecting Ranges

To perform an operation on a range of cells in a worksheet, you must select the range of cells first. For example, if you want to make the text bold for a range of cells, you must select the range and then click the Bold button on the Formatting toolbar (or, use any of several other methods to make the text bold).

When you select a range, the cells appear highlighted in light blue-gray. The exception is the active cell, which remains its normal color. Figure 8 shows an example of a selected range in a worksheet.

Figure 8. A worksheet with the selected range of a9:d15.

You can select a range in several ways:

o Use the mouse to drag, highlighting the range. If you drag to the end of the screen, the worksheet will scroll. o Press the Shift key while you use the direction keys to select a range. o Press F8 and then move the cell pointer with the direction keys to highlight the range. Press F8 again to return the direction keys to normal movement. o Use the Edit -> Go To command (or press F5) and enter a range’s address manually into the Go To dialog box. When you click OK, Excel selects the cells in the range that you specified.

(2) Selecting complete rows and columns

You can select entire rows and columns in much the same manner as you select ranges, as follows:

  • Click the row or column border to select a single row or column.

(4) Special selections

The Edit -> Go To command (or F5) was mentioned earlier as a way to select (or go to) a cell or range. Excel also provides a way to select only “special” cells in the workbook or in a selected range. You do this by choosing Edit -> Go To, which brings up the Go To dialog box. Clicking the Special button displays the Go To Special dialog box, shown in Figure10.

Figure 10. The Go To Special dialog box.

After you make your choice in the dialog box, Excel selects the qualifying subset of cells in the current selection. Usually, this results in a multiple selection. If no cells qualify, Excel lets you know.

A description of the options available in the Go To Special dialog Box is listed below. Some of the options can be quite useful.

Comments Selects only the cells that contain cell comments (see the next section). Ctrl+Shift+? is the shortcut. Constants Selects all nonempty cells that don’t contain formulas. This option is useful if you have a model set up and want to clear out all input cells and enter new values. The formulas remain intact. Formulas Selects cells that contain formulas. Qualify this by selecting the type of result: numbers, text, logical values (TRUE or FALSE), or errors. These terms are described in the next chapter. Blanks Selects all empty cells. Current Region Selects a rectangular range of cells around the active cell. This range is determined by surrounding blank rows and columns. Ctrl+* is the shortcut. Current Array Selects the entire array. Arrays are covered in Chapter 20. Objects Selects all graphic objects on the worksheet. Row Differences Analyzes the selection and selects cells that are different from other cells in each row. Ctrl+\ is the shortcut.

Column Differences Analyzes the selection and selects the cells that are different from other cells in each column. Ctrl+Shift+| is the shortcut. Precedents Selects cells that are referred to in the formulas in the active cell or selection. You can select either direct precedents or precedents at any level. Dependents Selects cells with formulas that refer to the active cell or selection. You can select either direct dependents or dependents at any level. Last Cell Selects the bottom-right cell in the worksheet that contains data or formatting. Ctrl+End is the shortcut. Visible Cells Only Selects only visible cells in the selection. This option is useful when dealing with outlines or an auto-filtered list. Conditional Formats Selects cells that have a conditional format applied (using the Format -> Conditional Formatting command). Data Validation Selects cells that are set up for data entry validation (using the Data -> Validation command). The All option selects all such cells. The Same option selects only the cells that have the same validation rules as the active cell.

(5) Annotating a cell

Excel’s cell-comment feature enables you to attach a comment to a cell. This feature is useful when you need to document a particular value. It’s also useful to help you remember what a formula does.

To add a comment to a cell, select the cell and then choose Insert -> Comment (or Shift+F2). Excel inserts a comment that points to the active cell, as shown in Figure 11. Initially, the comment consists of your name. Enter the text for the cell comment and then click anywhere in the worksheet to hide the comment.

Figure 11. Cell comment.

  • You can give a name to a value or formula —even when the value or formula doesn’t exist on the worksheet. For example, you can create the name Interest_Rate for a value of .075. Then, you can use this name in your formulas.

Valid name:

Although Excel is quite flexible about the names that you can define, it does have some rules:

  • Names can’t contain any spaces. You might want to use an underscore or a period character to simulate a space (such as Annual_Total or Annual.Total).
  • You can use any combination of letters and numbers, but the name must begin with a letter. A name can’t begin with a number (such as 3rdQuarter) or look like a cell reference (such as Q3).
  • Symbols, except for underscores and periods, aren’t allowed. Although it’s not documented, I’ve found that Excel also allows a backslash () and question mark (?).
  • Names are limited to 255 characters. Trust me —using a name anywhere near this length is not a good idea; in fact, it defeats the purpose of naming ranges.
  • You can use single letters (except for R or C), but this is generally not recommended because, again, it defeats the purpose of using meaningful names.

Excel also uses a few names internally for its own use. Although you can create names that override Excel’s internal names, you should avoid doing so. To be on the safe side, avoid using the following for names: Print_Area, Print_Titles, Consolidate_Area, and Sheet_Title.

Creating names manually:

To create a range name, start by selecting the cell or range that you want to name. Then, select Insert -> Name -> Define (or press Ctrl+F3). Excel displays the Define Name dialog box, shown in Figure 12.

Figure 12. Creating a name for a cell or a range.

Creating a table of names:

After you create a large number of names, you may need to know the ranges that each name defines, particularly if you’re trying to track down errors or document your work. Excel lets you create a list of all names in the workbook and their corresponding addresses. To create a table of names, first move the cell pointer to an empty area of your worksheet —the table is created at the active cell position and will overwrite any information at that location. Use the Insert -> Name -> Paste command (or F3). Excel displays the Paste Name dialog box, shown in Figure 13, which lists all the defined names. To paste a list of names, click the Paste List button.

Figure 13. Paste name dialog box.

Deleting names:

If you no longer need a defined name, you can delete it. Deleting a range name does not delete information in the range; it can, however, make formulas in your workbook invalid.

Choose Insert -> Name -> Define to display the Define Name dialog box. Choose the name that you want to delete from the list and then click the Delete button.

Changing names:

Excel doesn’t have a simple way to change a name once you create the name. If you create a name and then realize that it’s not the name that you want —or, perhaps, that you spelled it incorrectly —you must create the new name and then delete the old name.

Class Exercises

(1) Lab 2

References

Walkenbach, J. 1999. Microsoft Excel 2000 Bible. IDG Books Worldwide, Inc. Foster City, CA.