Page 357 - Excel 2007 Bible
P. 357

22_044039 ch17.qxp  11/21/06  11:08 AM  Page 314
                                   Part II
                                              Working with Formulas and Functions
                                             A multicell array formula
                                             Figure 17.1 shows a simple worksheet set up to calculate product sales. Normally, you’d calculate the value
                                             in column D (total sales per product) with a formula such as the one that follows, and then you’d copy this
                                             formula down the column.
                                                  =B2*C2
                                             After copying the formula, the worksheet contains six formulas in column D.
                                       FIGURE 17.1
                                      Column D contains formulas to calculate the total for each product.
                                             An alternative method uses a single formula (an array formula) to calculate all six values in D2:D7. This sin-
                                             gle formula occupies six cells and returns an array of six values.
                                             To create a single array formula to perform the calculations, follow these steps:
                                                 1. Select a range to hold the results. In this case, the range is D2:D7.
                                                 2. Enter the following formula:
                                                    =B2:B7*C2:C7
                                                 3. Press Ctrl+Shift+Enter to enter the formula. Normally, you press Enter to enter a formula.
                                                    Because this is an array formula, however, press Ctrl+Shift+Enter.
                                        CAUTION
                                        CAUTION        You can’t insert a multicell array formula into a range that has been designated a table. You
                                                       designate a table using the Excel 2007 Insert ➪ Tables ➪ Table command). In addition, you
                                             can’t convert a range that contains a multicell array formula to a table.
                                             The formula is entered into all six of the selected cells. If you examine the Formula bar, you see the following:
                                                  {=B2:B7*C2:C7}
                                             Excel places curly brackets around the formula to indicate that it’s an array formula.
                                             This formula performs its calculations and returns a six-item array. The array formula actually works with
                                             two other arrays, both of which happen to be stored in ranges. The values for the first array are stored in
                                             B2:B7, and the values for the second array are stored in C2:C7.
                                             Because you can’t display more than one value in a single cell, six cells are required to display the resulting
                                             array — which explains why you selected six cells before you entered the array formula.







                                      314
   352   353   354   355   356   357   358   359   360   361   362