Editing Cell Contents

You can use the formula bar to edit the contents of a selected cell, or you can perform your editing “on location” in the cell. Excel 2010 also includes a few special features you can apply to tasks such as entering date sequences, which once involved editing each cell but are now semiautomatic, if you know where to find the “trigger.”

While typing or editing the contents of a cell, you can use Cut, Copy, Paste, and Clear to manipulate cell entries. Often, retyping a value or formula is easier, but using commands is convenient when you’re working with long, complex formulas or with labels. When you’re working in a cell or in the formula bar, these commands work just as they do in a word-processing program such as Word. For example, you can copy all or part of a formula from one cell to another. For example, suppose cell A10 contains the formula =IF(NPV(.15,A1:A9)>0,A11,A12) and you want to type =NPV(.15,A1:A9) in cell B10.

image with no caption

To do so, select cell A10, and in the formula bar, select the characters you want to copy—in this case, NPV(.15,A1:A9). Then press Ctrl+C, or click the Copy button (located in the Clipboard group on the Home tab). Finally, select cell B10, type = to begin a formula, and press Ctrl+V (or click the Paste button).

When you type or edit formulas containing references, Excel gives you visual aids called range finders to help you audit, as shown in Figure 8-19, where we obviously have a problem with our SUM formula. The total should include all the rows of data, so drag a handle on a bottom corner of the range selection rectangle until it includes all the correct cells.

The Advanced category in the Excel Options dialog box (click the File tab and then Options) contains an assortment of options that control editing-related workspace settings, as shown in Figure 8-20. These options include the following:

As described earlier in this chapter, the fill handle has many talents to make it simple to enter data in worksheets. Uses of the fill handle include quickly and easily filling cells and creating data series by using the incredibly useful Auto Fill feature.

Take a look at Figure 8-21. If you select cell B2 in this worksheet and drag the fill handle down to cell B5, Excel copies the contents of cell B2 to cells B3 through B5. However, if you click the floating Auto Fill Options button that appears after you drag, you can select a different Auto Fill action, as shown in Figure 8-22.

If you click Fill Series on the Auto Fill Options menu, Excel creates the simple series 21, 22, and 23 instead of copying the contents of cell C2. If, instead of selecting a single cell, you select the range C1:C2 in Figure 8-22 and drag the fill handle down to cell C5, you create a series that is based on the interval between the two selected values, resulting in the series 30, 40, and 50 in cells C3:C5. If you click Copy Cells on the Auto Fill Options menu, Excel copies the cells instead of extending the series, repeating the pattern of selected cells as necessary to fill the range. Instead of filling C3:C5 with the values 30, 40, and 50, choosing Copy Cells will enter the values 10, 20, and 10 in C3:C5.

If you select a text value and drag the fill handle, Excel copies the text to the cells where you drag. If, however, the selection contains both text and numeric values, the Auto Fill feature takes over and extends the numeric component while copying the text component. You can also extend dates in this way, using a number of date formats, including Qtr 1, Qtr 2, and so on. If you type text that describes dates, even without numbers (such as months or days of the week), Excel treats the text as a series.

Figure 8-23 shows some examples of simple data series created by selecting single cells containing values and dragging the fill handle. We typed the values in column A, and we extended the values to the right of column A using the fill handle. Figure 8-24 shows examples of creating data series using two selected values that, in effect, specify the interval to be used in creating the data series. We typed the values in columns A and B and extended the values to the right of column B using the fill handle. These two figures also show how Auto Fill can create a series even when you mix text and numeric values in cells. Also note that we extended the values and series in Figure 8-24 by selecting the entire range of starting values in cells A3:B12 before dragging the fill handle to extend them, showing how Excel can extend multiple series at once. (We applied the bold formatting after filling to make it easier to differentiate the starting values.)

image with no caption

Clicking the Series command on the Home tab, Editing Group, Fill menu displays the Series dialog box shown in Figure 8-28, letting you create custom incremental series. Alternatively, you can display the Series dialog box by selecting one or more cells containing numbers, dragging the fill handle with the right mouse button, and clicking Series on the shortcut menu.

In the Series dialog box you can specify an interval with which to increment the series (step value) and a maximum value for the series (stop value). Using this method has a couple of advantages over direct mouse manipulation techniques. First, you do not need to select a range to fill, and second, you can specify increments (step values) without first selecting cells containing examples of incremented values. You can select examples of values if you want, but it is not necessary.

The Rows option tells Excel to use the first value in each row to fill the cells to the right. The Columns option tells Excel to use the first value in each column to fill the cells below. For example, if you select a range of cells in advance that is taller than it is wide, Excel automatically selects the Columns option when you open the Series dialog box. Excel uses the Type options in conjunction with the start values in selected cells and the value in the Step Value box to create your series. If you select examples first, Step Value reflects the increment between the selected cells.

The Linear option adds the value specified in the Step Value box to the selected values in your worksheet to extend the series. The Growth option multiplies the last value in the selection by the step value and extrapolates the rest of the values to create the series. If you select the Date option, you can specify the type of date series from the options in the Date Unit area. The Auto Fill option works like using the fill handle to drag a series, extending the series by using the interval between the selected values; it determines the type of data and attempts to “divine” your intention. Selecting the Trend check box extrapolates an exponential series, but it works only if you select more than one value before displaying the Series dialog box.

Use the Down, Right, Up, and Left commands on the Fill menu, shown in Figure 8-29, to copy selected cells to an adjacent range of cells. Before clicking these commands, select the range you want to fill, including the cell or cells containing the formulas, values, and formats you want to use to fill the selected range. (Comments are not included when you use these Fill commands.)

Suppose cell A1 contains the value 100. In Figure 8-29, we selected the range A1:K2 and then clicked Fill, Right to copy the value 100 across row 1. With the range still selected, we can click Fill, Down to finish filling the selected range with the original value.

The Across Worksheets command on the Fill menu copies cells from one worksheet to other worksheets in the same workbook. For more information about using the Across Worksheets command, see Filling a Group on page 260.

Clicking Fill, Justify doesn’t do what you might think it does. It splits a cell entry and distributes it into two or more adjacent rows. Unlike other Fill commands, Justify modifies the contents of the original cell.

For example, in the worksheet on the left in Figure 8-30, cell A1 contains a long text entry. To divide this text into cell-sized parts, select cell A1, and click Home, Fill, Justify. The result appears on the right in Figure 8-30.

When you click Justify, Excel displays a message warning you that this command uses as many cells below the selection as necessary to distribute the contents. Excel overwrites any cells that are in the way in the following manner:

Excel has several AutoFormat features designed to help speed things up as you work. The format-extension feature lets you add new rows and columns of data to a previously constructed table without having to apply formatting to the new cells—theoretically, at least. For example, if you want to add another column to the existing table in Figure 8-32, select cell E3, type the column heading, and then continue entering numbers in cells E4–E7. Excel surmises that you want the new entries to use the same formatting as the adjacent cells above or to the left and picks up their cell and text formats.

However, as you can see in Figure 8-32, border formats are not picked up, and the feature does not work when entering formulas, as in cells E8 and E9. To be fair, it would make more sense to select the formulas in D8:D9 and drag the fill handle to the right, which would copy the formats, too. So, the format-extension feature does help, but expect to do some cleanup. You can turn this feature off by clicking the File tab, clicking Options, and then in the Advanced category clearing the Extend Data Range Formats And Formulas check box.

Tables are another feature with special AutoFormat qualities. If you are working with a table, additional options control the extension of formatting and formulas. Click the File tab, click Options, and then select the Proofing category. Click the AutoCorrect Options button to display the AutoCorrect dialog box shown in Figure 8-33. The tab labeled AutoFormat As You Type contains the pertinent options.

As you can see in Figure 8-33, the AutoFormat As You Type tab includes two options pertaining to tables and one that controls whether Excel automatically creates hyperlinks whenever you type recognizable Internet and network paths. This is very handy if you want to include one-click access to supporting information in your worksheets—or very annoying if you don’t.