Chapter 5. Working with Cells and Ranges

<feature><title>In This Chapter</title> </feature>

Most of the work you do in Excel involves cells and ranges. Understanding how best to manipulate cells and ranges will save you time and effort. This chapter discusses a variety of techniques that you can use to help increase your efficiency.

Understanding Cells and Ranges

A cell is a single element in a worksheet that can hold a value, some text, or a formula. A cell is identified by its address, 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 range. 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:

C24

A range that consists of a single cell.

A1:B1

Two cells that occupy one row and two columns.

A1:A100

100 cells in column A.

A1:D4

16 cells (four rows by four columns).

C1:C1048576

An entire column of cells; this range also can be expressed as C:C.

A6:XFD6

An entire row of cells; this range also can be expressed as 6:6.

A1:XFD1048576

All cells in a worksheet.

Selecting ranges

To perform an operation on a range of cells in a worksheet, you must first select the range. For example, if you want to make the text bold for a range of cells, you must select the range and then choose Home Selecting ranges Font Selecting ranges Bold (or press Ctrl+B).

When you select a range, the cells appear highlighted. The exception is the active cell, which remains its normal color. Figure 5.1 shows an example of a selected range (B4:C11) in a worksheet. Cell B4, the active cell, is selected but not highlighted.

When you select a range, it appears highlighted, but the active cell within the range is not highlighted.

Figure 5.1. When you select a range, it appears highlighted, but the active cell within the range is not highlighted.

You can select a range in several ways:

  • Press the left mouse button and drag, highlighting the range. If you drag to the end of the screen, the worksheet will scroll.

  • Press the Shift key while you use the direction keys to select a range.

  • 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.

  • Type the cell or range address into the Name box and press Enter. Excel selects the cell or range that you specified.

  • Choose Home, When you select a range, it appears highlighted, but the active cell within the range is not highlighted. Editing When you select a range, it appears highlighted, but the active cell within the range is not highlighted. Find & Select When you select a range, it appears highlighted, but the active cell within the range is not highlighted. Go To (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.

Tip

As you’re selecting a range, Excel displays the number of rows and columns in your selection in the Name box (located on the left side of the Formula bar). As soon as you finish the selection, the Name box reverts to showing the address of the active cell.

Selecting complete rows and columns

Often, you’ll need to select an entire row or column. For example, you may want to apply the same numeric format or the same alignment options to an entire row or column. You can select entire rows and columns in much the same manner as you select ranges:

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

  • To select multiple adjacent rows or columns, click a row or column border and drag to highlight additional rows or columns.

  • To select multiple (nonadjacent) rows or columns, press Ctrl while you click the row or column borders that you want.

  • Press Ctrl+spacebar to select a column. The column of the active cell (or columns of the selected cells) is highlighted.

  • Press Shift+spacebar to select a row. The row of the active cell (or rows of the selected cells) is highlighted.

Tip

Press Ctrl+A to select all cells in the worksheet, which is the same as selecting all rows and all columns. You can also click the area at the intersection of the row and column borders to select all cells.

Selecting noncontiguous ranges

Most of the time, the ranges that you select are contiguous—a single rectangle of cells. Excel also enables you to work with noncontiguous ranges, which consist of two or more ranges (or single cells) that aren’t next to each other. Selecting noncontiguous ranges is also known as a multiple selection. If you want to apply the same formatting to cells in different areas of your worksheet, one approach is to make a multiple selection. When the appropriate cells or ranges are selected, the formatting that you select is applied to them all. Figure 5.2 shows a noncontiguous range selected in a worksheet. (Three ranges are selected.)

Excel enables you to select noncontiguous ranges.

Figure 5.2. Excel enables you to select noncontiguous ranges.

You can select a noncontiguous range in several ways:

  • Select the first range (or cell). Then press Ctrl as you click and drag the mouse to highlight additional cells or ranges.

  • From the keyboard, select a range as described previously (using F8 or the Shift key). Then press Shift+F8 to select another range without canceling the previous range selections.

  • Enter the range (or cell) address in the Name box and press Enter. Separate each range address with a comma.

  • Choose Home Excel enables you to select noncontiguous ranges. Editing Excel enables you to select noncontiguous ranges. Find & Select Excel enables you to select noncontiguous ranges. Go To (or press F5) to display the Go To dialog box. Enter the range (or cell) address in the Reference box and separate each range address with a comma. Click OK, and Excel selects the ranges.

Note

Noncontiguous ranges differ from contiguous ranges in several important ways. One obvious difference is that you can’t use drag-and-drop methods to move or copy noncontiguous ranges.

Selecting multisheet ranges

In addition to two-dimensional ranges on a single worksheet, ranges can extend across multiple worksheets to be three-dimensional ranges.

Suppose that you have a workbook set up to track budgets. A common approach is to use a separate worksheet for each department, making it easy to organize the data. You can click a sheet tab to view the information for a particular department.

Figure 5.3 shows a simplified example. The workbook has four sheets, named Totals, Marketing, Operations, and Manufacturing. The sheets are laid out identically. The only difference is the values. The Totals sheet contains formulas that compute the sum of the corresponding items in the three departmental worksheets.

The worksheets in this workbook are laid out identically.

Figure 5.3. The worksheets in this workbook are laid out identically.

On the CD-ROM

This workbook, named budget.xlsx, is available on the companion CD-ROM.

Assume that you want to apply formatting to the sheets—for example, make the column headings bold with background shading. One (not so efficient) approach is simply to format the cells in each worksheet separately. A better technique is to select a multisheet range and format the cells in all the sheets simultaneously. The following is a step-by-step example of multisheet formatting, using the workbook shown in Figure 5.3.

  1. Activate the Totals worksheet by clicking its tab.

  2. Select the range B3:F3.

  3. Press Shift and click the sheet tab labeled Manufacturing. This step selects all worksheets between the active worksheet (Totals) and the sheet tab that you click—in essence, a three-dimensional range of cells (see Figure 5.4). Notice that the workbook window’s title bar displays [Group] to remind you that you’ve selected a group of sheets and that you’re in Group edit mode.

    In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets.

    Figure 5.4. In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets.

  4. Choose Home In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets. Font In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets. Bold and then choose Home In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets. Font In Group mode, you can work with a three-dimensional range of cells that extend across multiple worksheets. Fill Color to apply a colored background.

  5. Click one of the other sheet tabs. This step selects the sheet and also cancels Group mode; [Group] is no longer displayed in the title bar. Excel applies the formatting to the selected range across the selected sheets.

When a workbook is in Group mode, any changes that you make to cells in one worksheet also apply to all the other grouped worksheets. You can use this to your advantage when you want to set up a group of identical worksheets because any labels, data, formatting, or formulas you enter are automatically added to the same cells in all the grouped worksheets.

Note

When Excel is in Group mode, some commands are “grayed out” and can’t be used. In the preceding example, you can’t convert all these ranges to tables by choosing Insert Note Tables Note Table.

In general, selecting a multisheet range is a simple two-step process: Select the range in one sheet and then select the worksheets to include in the range. To select a group of contiguous worksheets, you can press Shift and click the sheet tab of the last worksheet that you want to include in the selection. To select individual worksheets, press Ctrl and click the sheet tab of each worksheet that you want to select. If all the worksheets in a workbook aren’t laid out the same, you can skip the sheets that you don’t want to format. When you make the selection, the sheet tabs of the selected sheets appear with a white background, and Excel displays [Group] in the title bar.

Tip

To select all sheets in a workbook, right-click any sheet tab and choose Select All Sheets from the shortcut menu.

Selecting special types of cells

As you use Excel, you may need to locate specific types of cells in your worksheets. For example, wouldn’t it be handy to be able to locate every cell that contains a formula—or perhaps all the cells whose value depends on the current cell? Excel provides an easy way to locate these and many other special types of cells. Simply choose Home Selecting special types of cells Select & Find Selecting special types of cells Go To Special to display the Go To Special dialog box, shown in Figure 5.5.

Use the Go To Special dialog box to select specific types of cells.

Figure 5.5. Use the Go To Special dialog box to select specific types of cells.

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

Tip

If you bring up the Go To Special dialog box with only one cell selected, Excel bases its selection on the entire used area of the worksheet. Otherwise, the selection is based on the selected range.

Table 5.1 offers a description of the options available in the Go To Special dialog box. Some of the options are very useful.

Table 5.1. Go To Special Options

Option

What It Does

Comments

Selects only the cells that contain a cell comment.

Constants

Selects all nonempty cells that don’t contain formulas. Use the check boxes under the Formulas option to choose which types of nonformula cells to include.

Formulas

Selects cells that contain formulas. Qualify this by selecting the type of result: numbers, text, logical values (TRUE or FALSE), or errors.

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. You can also the use Ctrl+Shift+* shortcut key combination.

Current Array

Selects the entire array. See Chapter 17 for more information about arrays.

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.

Column Differences

Analyzes the selection and selects the cells that are different from other cells in each column.

Precedents

Selects cells that are referred to in the formulas in the active cell or selection (limited to the active sheet). You can select either direct precedents or precedents at any level.

Dependents

Selects cells with formulas that refer to the active cell or selection (limited to the active sheet). 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.

Visible Cells Only

Selects only visible cells in the selection. This option is useful when dealing with outlines or a filtered table.

Conditional Formats

Selects cells that have a conditional format applied (by choosing Home Go To Special Options Styles Go To Special Options Conditional Formatting).

Data Validation

Selects cells that are set up for data-entry validation (by choosing Data Go To Special Options Date Tools Go To Special Options Data Validation). The All option selects all such cells. The Same option selects only the cells that have the same validation rules as the active cell.

Tip

When you select an option in the Go To Special dialog box, be sure to note which suboptions become available. For example, when you select Constants, the suboptions under Formulas become available to help you further refine the results. Likewise, the suboptions under Dependents also apply to Precedents, and those under Data Validation also apply to Conditional formats.

Selecting cells by searching

Another way to select cells is to use Excel’s Home Selecting cells by searching Editing Selecting cells by searching Find & Select Selecting cells by searching Find command (or press Ctrl+F), which allows you to select cells by their contents. The Find And Replace dialog box is shown in Figure 5.6. This figure shows additional options that are available when you click the Options button.

The Find And Replace dialog box, with its options displayed.

Figure 5.6. The Find And Replace dialog box, with its options displayed.

Enter the text that you’re looking for; then click Find All. The dialog box expands to display all the cells that match your search criteria. For example, Figure 5.7 shows the dialog box after Excel has located all cells that contain the text Tucson. You can click an item in the list, and the screen will scroll so that you can view the cell in context. To select all the cells in the list, first select any single item in the list. Then press Ctrl+A to select them all.

The Find And Replace dialog box, with its results listed.

Figure 5.7. The Find And Replace dialog box, with its results listed.

Note that the Find and Replace dialog box allows you to return to the worksheet without dismissing the dialog box.

Copying or Moving Ranges

As you create a worksheet, you may find it necessary to copy or move information from one location to another. Excel makes copying or moving ranges of cells easy. Here are some common things you might do:

  • Copy a cell to another cell.

  • Copy a cell to a range of cells. The source cell is copied to every cell in the destination range.

  • Copy a range to another range. Both ranges must be the same size.

  • Move a range of cells to another location.

The primary difference between copying and moving a range is the effect of the operation on the source range. When you copy a range, the source range is unaffected. When you move a range, the contents are removed from the source range.

Note

Copying a cell normally copies the cell’s contents, any formatting that is applied to the original cell (including conditional formatting and data validation), and the cell comment (if it has one). When you copy a cell that contains a formula, the cell references in the copied formulas are changed automatically to be relative to their new destination.

Copying or moving consists of two steps (although shortcut methods do exist):

  1. Select the cell or range to copy (the source range) and copy it to the Clipboard. To move the range instead of copying it, cut the range rather than copying it.

  2. Move the cell pointer to the range that will hold the copy (the destination range) and paste the Clipboard contents.

Caution

When you paste information, Excel overwrites any cells that get in the way without warning you. If you find that pasting overwrote some essential cells, choose Undo from the Quick Access Toolbar (or press Ctrl+Z).

Note

When you copy a cell or range, Excel surrounds the copied area with an animated border (sometimes referred to as “marching ants”). As long as that border remains animated, the copied information is available for pasting. If you press Esc to cancel the animated border, Excel removes the information from the Clipboard.

Because copying (or moving) is used so often, Excel provides many different methods. I discuss each method in the following sections. Copying and moving are similar operations, so I point out only important differences between the two.

Copying by using Ribbon commands

Choosing Home Copying by using Ribbon commands Clipboard Copying by using Ribbon commands Copy transfers a copy of the selected cell or range to the Windows Clipboard and the Office Clipboard. After performing the copy part of this operation, select the cell that will hold the copy and choose Home Copying by using Ribbon commands Clipboard Copying by using Ribbon commands Paste.

Rather than using Home Copying by using Ribbon commands Clipboard Copying by using Ribbon commands Paste, you can just activate the destination cell and press Enter. If you use this technique, Excel removes the copied information from the Clipboard so that it can’t be pasted again.

Note

If you click the Copy button more than once before you click the Paste button, Excel may automatically display the Office Clipboard task bar. To prevent this task bar from appearing, click the Options button at the bottom and then remove the check mark from Show Office Clipboard Automatically.

If you’re copying a range, you don’t need to select an entire same-sized range before you click the Paste button. You need only activate the upper-left cell in the destination range.

Copying by using shortcut menu commands

If you prefer, you can use the following shortcut menu commands for copying and pasting:

  • Right-click the range and choose Copy (or Cut) from the shortcut menu to copy the selected cells to the Clipboard.

  • Right-click and choose Paste from the shortcut menu that appears to paste the Clipboard contents to the selected cell or range.

Rather than using Paste, you can just activate the destination cell and press Enter. If you use this technique, Excel removes the copied information from the Clipboard so that it can’t be pasted again.

Copying by using shortcut keys

The copy and paste operations also have shortcut keys associated with them:

  • Ctrl+C copies the selected cells to both the Windows and Office Clipboards.

  • Ctrl+X cuts the selected cells to both the Windows and Office Clipboards.

  • Ctrl+V pastes the Windows Clipboard contents to the selected cell or range.

Tip

Most other Windows applications also use these shortcut keys.

Copying or moving by using drag-and-drop

Excel also enables you to copy or move a cell or range by dragging. Be aware, however, that dragging and dropping does not place any information on either the Windows Clipboard or the Office Clipboard.

Note

The drag-and-drop method of moving does offer one advantage over the cut-and-paste method—Excel warns you if a drag-and-drop move operation will overwrite existing cell contents. However, you do not get a warning if a drag-and-drop copy operation will overwrite existing cell contents.

To copy using drag-and-drop, select the cell or range that you want to copy and then press Ctrl and move the mouse to one of the selection’s borders (the mouse pointer is augmented with a small plus sign). Then, simply drag the selection to its new location while you continue to press the Ctrl key. The original selection remains behind, and Excel makes a new copy when you release the mouse button. To move a range using drag-and-drop, don’t press Ctrl while dragging the border.

Tip

If the mouse pointer doesn’t turn into an arrow when you point to the border of a cell or range, you need to make a change to your settings. Access the Excel Options dialog box, click the Advanced tab, and place a check mark on the option labeled Enable Fill Handle And Cell Drag-And-Drop.

Copying to adjacent cells

Often, you’ll find that you need to copy a cell to an adjacent cell or range. This type of copying is quite common when working with formulas. For example, if you’re working on a budget, you might create a formula to add the values in column B. You can use the same formula to add the values in the other columns. Rather than re-enter the formula, you can copy it to the adjacent cells.

Excel provides additional options for copying to adjacent cells. To use these commands, select the cell that you’re copying and the cells that you’re copying to. Then issue the appropriate command from the following list for one-step copying:

  • Home Copying to adjacent cells Editing Copying to adjacent cells Fill Copying to adjacent cells Down (or Ctrl+D) copies the cell to the selected range below.

  • Home Copying to adjacent cells Editing Copying to adjacent cells Fill Copying to adjacent cells Right (or Ctrl+R) copies the cell to the selected range to the right.

  • Home Copying to adjacent cells Editing Copying to adjacent cells Fill Copying to adjacent cells Up copies the cell to the selected range above.

  • Home Copying to adjacent cells Editing Copying to adjacent cells Fill Copying to adjacent cells Left copies the cell to the selected range to the left.

None of these commands places information on either the Windows Clipboard or the Office Clipboard.

Tip

You also can use AutoFill to copy to adjacent cells by dragging the selection’s fill handle (the small square in the bottom-right corner of the selected cell or range). Excel copies the original selection to the cells that you highlight while dragging. For more control over the AutoFill operation, drag the fill handle with the right mouse button, and you’ll get a shortcut menu with additional options.

Copying a range to other sheets

You can use the copy procedures described previously to copy a cell or range to another worksheet, even if the worksheet is in a different workbook. You must, of course, activate the other worksheet before you select the location to which you want to copy.

Excel offers a quicker way to copy a cell or range and paste it to other worksheets in the same workbook. Start by selecting the range to copy. Then, press Ctrl and click the sheet tabs for the worksheets to which you want to copy the information. (Excel displays [Group] in the workbook’s title bar.) Choose Home Copying a range to other sheets Editing Copying a range to other sheets Fill Copying a range to other sheets Across Worksheets, and a dialog box appears to ask you what you want to copy (All, Contents, or Formats). Make your choice and then click OK. Excel copies the selected range to the selected worksheets; the new copy occupies the same cells in the selected worksheets as the original occupies in the initial worksheet.

Caution

Be careful with the Home Caution Editing Caution Fill Caution Across Worksheets command because Excel doesn’t warn you when the destination cells contain information. You can quickly overwrite lots of cells with this command and not even realize it.

Using the Office Clipboard to paste

Whenever you cut or copy information in an Office program, such as Excel, you can place the data on both the Windows Clipboard and the Office Clipboard. When you copy information to the Office Clipboard, you append the information to the Office Clipboard instead of replacing what is already there. With multiple items stored on the Office Clipboard, you can then paste the items either individually or as a group.

To use the Office Clipboard, you first need to open it. Use the dialog launcher on the bottom right of the Home Using the Office Clipboard to paste Clipboard group to toggle the Clipboard task pane on and off.

Tip

To make the Clipboard task pane open automatically, click the Options button near the bottom of the task pane and choose the Show Office Clipboard Automatically option.

After you open the Clipboard task pane, select the first cell or range that you want to copy to the Office Clipboard and copy it by using any of the preceding techniques. Repeat this process, selecting the next cell or range that you want to copy. As soon as you copy the information, the Office Clipboard task pane shows you the number of items that you’ve copied and a brief description (it will hold up to 24 items). Figure 5.8 shows the Office Clipboard with five copied items.

Use the Clipboard task pane to copy and paste multiple items.

Figure 5.8. Use the Clipboard task pane to copy and paste multiple items.

When you’re ready to paste information, select the cell into which you want to paste information. To paste an individual item, click it in the Clipboard task pane. To paste all the items that you’ve copied, click the Paste All button.

You can clear the contents of the Office Clipboard by clicking the Clear All button.

The following items about the Office Clipboard and its functioning are worth noting:

  • Excel pastes the contents of the Windows Clipboard when you paste either by choosing Home Use the Clipboard task pane to copy and paste multiple items. Clipboard Use the Clipboard task pane to copy and paste multiple items. Paste, by pressing Ctrl+V, or by right-clicking to choose Paste from the shortcut menu.

  • The last item that you cut or copied appears on both the Office Clipboard and the Windows Clipboard.

  • Pasting from the Office Clipboard also places that item on the Windows Clipboard. If you choose Paste All from the Office Clipboard toolbar, you paste all items stored on the Office Clipboard onto the Windows Clipboard as a single item.

  • Clearing the Office Clipboard also clears the Windows Clipboard.

Warning

The Office Clipboard, however, has a serious problem that makes it virtually worthless for Excel users: If you copy a range that contains formulas, the formulas are not transferred when you paste to a different range. Only the values are pasted. Furthermore, Excel doesn’t even warn you about this fact.

Pasting in special ways

You may not always want to copy everything from the source range to the destination range. For example, you may want to copy only the formula results rather than the formulas themselves. Or you may want to copy the number formats from one range to another without overwriting any existing data or formulas.

To control what is copied into the destination range, choose Home Pasting in special ways Clipboard Pasting in special ways Paste and use the drop-down menu shown in Figure 5.9. Options are

  • Paste: Pastes the cell’s contents, formats, and data validation from the Windows Clipboard.

  • Formulas: Pastes formulas, but not formatting.

  • Paste Values: Pastes the results of formulas. The destination for the copy can be a new range or the original range. In the latter case, Excel replaces the original formulas with their current values.

  • No Borders: Pastes everything except any borders that appear in the source range.

  • Transpose: Changes the orientation of the copied range. Rows become columns, and columns become rows. Any formulas in the copied range are adjusted so that they work properly when transposed.

  • Paste Link: Creates formulas in the destination range that refer to the cells in the copied range.

  • Paste Special: Displays the Paste Special dialog box (described in the next section)

  • Paste As Hyperlink: Creates a clickable hyperlink to the copied cell or range, which can be in the same workbook or in a different workbook. The Paste As Hyperlink command is not available if the workbook has not been saved.

  • As Picture: Pastes the copied information as a picture. If you use the Paste Picture Link option, Excel creates a “live” picture that is updated if the source range is changed.

Excel offers several pasting options.

Figure 5.9. Excel offers several pasting options.

Using the Paste Special Dialog box

For maximum flexibility in what gets pasted, choose Home Using the Paste Special Dialog box Clipboard Using the Paste Special Dialog box Paste Using the Paste Special Dialog box Paste Special to display the Paste Special dialog box (see Figure 5.10). You can also right-click and select Paste Special to display this dialog box. This dialog box has several options, which I explain in the following list.

The Paste Special dialog box.

Figure 5.10. The Paste Special dialog box.

Note

Excel actually has several different Paste Special dialog boxes. The one displayed depends on what’s copied. This section describes the Paste Special dialog box that appears when a range or cell has been copied.

Tip

For the Paste Special command to be available, you need to copy a cell or range. (Choosing Home Tip Clipboard Tip Cut doesn’t work.)

  • All: Pastes the cell’s contents, formats, and data validation from the Windows Clipboard.

  • Formulas: Pastes values and formulas, with no formatting.

  • Values: Pastes values and the results of formulas (no formatting). The destination for the copy can be a new range or the original range. In the latter case, Excel replaces the original formulas with their current values.

  • Formats: Copies only the formatting.

  • Comments: Copies only the cell comments from a cell or range. This option doesn’t copy cell contents or formatting.

  • Validation: Copies the validation criteria so the same data validation will apply. Data validation is applied by choosing Data Validation: Data Tools Validation: Data Validation.

  • All Using Source Theme: Pastes everything, but uses the formatting from the document theme of the source. This option is relevant only if you’re pasting information from a different workbook, and the workbook uses a different document theme than the active workbook.

  • All Except Borders: Pastes everything except borders that appear in the source range.

  • Column Widths: Pastes only column width information.

  • Formulas And Number Formats: Pastes all values, formulas and number formats (but no other formatting).

  • Values And Number Formats: Pastes all values and numeric formats, but not the formulas themselves.

In addition, the Paste Special dialog box enables you to perform other operations, described in the following sections.

Performing mathematical operations without formulas

The option buttons in the Operation section of the Paste Special dialog box let you perform an arithmetic operation. For example, you can copy a range to another range and select the Multiply operation. Excel multiplies the corresponding values in the source range and the destination range and replaces the destination range with the new values.

This feature also works with a single copied cell, pasted to a range. Assume that you have a range of values, and you want to increase each value by 5 percent. Enter 105% into any blank cell and copy that cell to the Clipboard. Then select the range of values and bring up the Paste Special dialog box. Select the Multiply option, and each value in the range is multiplied by 105 percent.

Warning

If the destination range contains formulas, the formulas are also modified. In many cases, this is not what you want.

Skipping blanks when pasting

The Skip Blanks option in the Paste Special dialog box prevents Excel from overwriting cell contents in your paste area with blank cells from the copied range. This option is useful if you’re copying a range to another area but don’t want the blank cells in the copied range to overwrite existing data.

Transposing a range

The Transpose option in the Paste Special dialog box changes the orientation of the copied range. Rows become columns, and columns become rows. Any formulas in the copied range are adjusted so that they work properly when transposed. Note that you can use this check box with the other options in the Paste Special dialog box. Figure 5.11 shows an example of a horizontal range (A1:F1) that was transposed to a vertical range (A3:A8).

Transposing a range changes the orientation as the information is pasted into the worksheet.

Figure 5.11. Transposing a range changes the orientation as the information is pasted into the worksheet.

Tip

If you click the Paste Link button in the Paste Special dialog box, you create formulas that link to the source range. As a result, the destination range automatically reflects changes in the source range.

Using Names to Work with Ranges

Dealing with cryptic cell and range addresses can sometimes be confusing. (This confusion becomes even more apparent when you deal with formulas, which I cover in Chapter 11.) Fortunately, Excel allows you to assign descriptive names to cells and ranges. For example, you can give a cell a name such as Interest_Rate, or you can name a range JulySales. Working with these names (rather than cell or range addresses) has several advantages:

  • A meaningful range name (such as Total_Income)) is much easier to remember than a cell address (such as AC21).

  • Entering a name is less error-prone than entering a cell or range address.

  • You can quickly move to areas of your worksheet either by using the Name box, located at the left side of the Formula bar (click the arrow to drop down a list of defined names) or by choosing Home Using Names to Work with Ranges Editing Using Names to Work with Ranges Find & Select Using Names to Work with Ranges Go To (or F5) and specifying the range name.

  • Creating formulas is easier. You can paste a cell or range name into a formula by using Formula Autocomplete, a new feature in Excel 2007.

  • Names make your formulas more understandable and easier to use. A formula such as =Income—Taxes is more intuitive than =D20—D40.

Creating range names in your workbooks

Excel provides several different methods that you can use to create range names. Before you begin, however, you should be aware of some important rules about what is acceptable:

  • Names can’t contain any spaces. You may want to use an underscore character to simulate a space (such as 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 QTR3). If these are desirable names, you can precede the name with underscore: _3rd Quarter and _QTR3.

  • Symbols, except for underscores and periods, aren’t allowed.

  • Names are limited to 255 characters, but it’s a good practice to keep names as short as possible yet still meaningful and understandable.

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.

Using the New Name dialog box

To create a range name, start by selecting the cell or range that you want to name. Then, choose Formulas Using the New Name dialog box Defined Names Using the New Name dialog box Define Name. Excel displays the New Name dialog box, shown in Figure 5.12. Note that this is a resizable dialog box. Click and drag a border to change the dimensions.

Create names for cells or ranges by using the New Name dialog box.

Figure 5.12. Create names for cells or ranges by using the New Name dialog box.

Type a name in the box labeled Name (or use the name that Excel proposes, if any). The selected cell or range address appears in the box labeled Refers To. Use the Scope drop-down to indicate the scope for the name. The scope indicates where the name will be valid, and it’s either the entire workbook, or a particular sheet. If you like, you can add a comment that describes the named range or cell. Click OK to add the name to your workbook and close the dialog box.

Using the Name box

A faster way to create a name is to use the Name box (to the left of the Formula bar). Select the cell or range to name, click the Name box, and type the name. Press Enter to create the name. (You must press Enter to actually record the name; if you type a name and then click in the worksheet, Excel doesn’t create the name.) If a name already exists, you can’t use the Name box to change the range to which that name refers. Attempting to do so simply selects the range.

The Name box is a drop-down list and shows all names in the workbook. To choose a named cell or range, click the Name box and choose the name. The name appears in the Name box, and Excel selects the named cell or range in the worksheet.

Using the Create Names From Selection dialog box

You may have a worksheet that contains text that you want to use for names for adjacent cells or ranges. For example, you may want to use the text in column A to create names for the corresponding values in column B. Excel makes this task easy to do.

To create names by using adjacent text, start by selecting the name text and the cells that you want to name. (These items can be individual cells or ranges of cells.) The names must be adjacent to the cells that you’re naming. (A multiple selection is allowed.) Then, choose Formulas Using the Create Names From Selection dialog box Defined Names Using the Create Names From Selection dialog box Create From Selection. Excel displays the Create Names From Selection dialog box, shown in Figure 5.13. The check marks in this dialog box are based on Excel’s analysis of the selected range. For example, if Excel finds text in the first row of the selection, it proposes that you create names based on the top row. If Excel didn’t guess correctly, you can change the check boxes. Click OK, and Excel creates the names.

Use the Create Names From Selection dialog box to name cells using labels that appear in the worksheet.

Figure 5.13. Use the Create Names From Selection dialog box to name cells using labels that appear in the worksheet.

Note

If the text contained in a cell would result in an invalid name, Excel modifies the name to make it valid. For example, if a cell contains the text Net Income (which is invalid for a name because it contains a space), Excel converts the space to an underscore character. If Excel encounters a value or a numeric formula where text should be, however, it doesn’t convert it to a valid name. It simply doesn’t create a name—and does not inform you of that fact.

Caution

If the upper-left cell of the selection contains text and you choose the Top Row and Left Column options, Excel uses that text for the name of the entire data excluding the top row and left column. So, before you accept the names that Excel creates, take a minute to make sure that they refer to the correct ranges. If Excel creates a names that is incorrect, you can delete or modify it by using the Name Manager (described next).

Managing Names

A workbook can have any number of names. If you have many names, you should know about the Name Manager, shown in Figure 5.14.

The Name Manager is new in Excel 2007.

Figure 5.14. The Name Manager is new in Excel 2007.

New Feature

The Name Manager is a new feature in Excel 2007.

The Name Manager appears when you choose Formulas New Feature Defined Names New Feature Name Manager (or press Ctrl+F3). The Name Manager has the following features:

  • Displays information about each name in the workbook. You can resize the Name Manager dialog box and widen the columns to show more information. You can also click a column heading to sort the information by the column.

  • Allows you to filter the displayed names. Clicking the Filter button lets you show only those names that meet a certain criteria. For example, you can view only the worksheet level names.

  • Provides quick access to the New Name dialog box. Click the New button to create a new name without closing the Name Manager.

  • Lets you edit names. To edit a name, select it in the list and then click the Edit button. You can change the name or the Refers To range or edit the comment.

  • Lets you quickly delete unneeded names. To delete a name, select it in the list and click Delete.

Caution

Be extra careful when deleting names. If the name is used in a formula, deleting the name causes the formula to become invalid. (It displays #NAME?.) However, deleting a name can be undone, so if you find that formulas return #NAME? after you delete a name, choose Undo from the Quick Access Toolbar (or press Ctrl+Z) to get the name back.

If you delete the rows or columns that contain named cells or ranges, the names contain an invalid reference. For example, if cell A1 on Sheet1 is named Interest and you delete row 1 or column A, the name Interest then refers to =Sheet1!#REF! (that is, to an erroneous reference). If you use Interest in a formula, the formula displays #REF.

Tip

The Name Manager is useful, but it has a shortcoming: It doesn’t let you display the list of names in a worksheet range so you can view or print them. Such a feat is possible, but you need to look beyond the Name Manager.

To create a list of names in a worksheet, first move the cell pointer to an empty area of your worksheet—the list is created at the active cell position and overwrites any information at that location. Press F3 to display the Paste Name dialog box, which lists all the defined names. Then click the Paste List button. Excel creates a list of all names in the workbook and their corresponding addresses.

Adding Comments to Cells

Documentation that explains certain elements in the worksheet can often be helpful. One way document your work is to add comments to cells. This feature is useful when you need to describe a particular value or explain how a formula works.

To add a comment to a cell, select the cell and then choose Review Adding Comments to Cells Comments Adding Comments to Cells New Comment. Alternative, you can right-click the cell and choose Insert Comment from the shortcut menu. Excel inserts a comment that points to the active cell. 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. You can change the size of the comment by clicking and dragging any of its borders. Figure 5.15 shows a cell with a comment.

You can add comments to cells to help clarify important items in your worksheets.

Figure 5.15. You can add comments to cells to help clarify important items in your worksheets.

Cells that have a comment display a small red triangle in the upper-right corner. When you move the mouse pointer over a cell that contains a comment, the comment becomes visible.

Tip

You can control how comments are displayed. Access the Advanced tab of the Excel Options dialog box. In the Display section, an option lets you turn off the comment indicators if you like.

Formatting comments

If you don’t like the default look of cell comments, use the Home Formatting comments Font and Home Formatting comments Alignment groups to make changes to the comment’s appearance.

For even more formatting options, right-click the comment’s border and choose Format Comment from the shortcut menu. Excel responds by displaying the Format Comment dialog box, which allows you to change many aspects of its appearance.

Tip

You can also display an image inside of a comment. Select the Colors and Lines tab in the Format Comment dialog box. Click the Color drop-down list and select Fill Effects. In the Fill Effects dialog box, click the Picture tab and then click the Select Picture Button to specify a graphics file. Figure 5.16 shows a comment that contains a picture.

This comment contains a graphic image.

Figure 5.16. This comment contains a graphic image.

Changing a comment’s shape

Normally, a cell comment is rectangular, but they don’t have to be. To change the shape of a cell comment, add a command to your Quick Access Toolbar (QAT):

  1. Right-click the QAT and select Customize Quick Access Toolbar. The Customization section of the Excel Options dialog box appears.

  2. In the drop-down list labeled Choose Commands From, select Drawing Tools | Format Tab.

  3. In the list on the left, select Change Shape and click the Add button.

  4. Click OK to close the Excel Options dialog box.

After performing these steps, your QAT has a new Change Shape icon.

To change the shape of a comment, make sure that it’s visible (right-click the cell and select Show/Hide Comments). Then click the comment’s border to select it as a Shape (or, Ctrl+click the comment to select it as a Shape). Click the Change Shape button on the QAT and choose a new shape for the comment. Figure 5.17 shows a cell comments with a nonstandard shape.

Cell comments don’t have to be rectangles.

Figure 5.17. Cell comments don’t have to be rectangles.

Reading comments

To read all of the comments in a workbook, choose Review Reading comments Comments Reading comments Next. Click this command repeatedly to cycle through all the comments in a workbook. Choose Review Reading comments Comments Reading comments Previous to view the comments in reverse order.

Hiding and showing comments

If you want all cell comments to be visible (regardless of the location of the cell pointer), choose Review Hiding and showing comments Comments Hiding and showing comments Show All Comments. This command is a toggle; select it again to hide all cell comments. To toggle the display of an individual comments, select its cell and then choose Review Hiding and showing comments Comments Hiding and showing comments Show/Hide Comment.

Editing comments

To edit a comment, activate the cell, right-click, and then choose Edit Comment from the shortcut menu. When you’ve made your changes, click any cell.

Deleting comments

To delete a cell comment, activate the cell that contains the comment and then choose Review Deleting comments Comments Deleting comments Delete. Or, right-click and then choose Delete Comment from the shortcut menu.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset