Page 373 - Excel 2007 Bible
P. 373

22_044039 ch17.qxp  11/21/06  11:08 AM  Page 330
                                   Part II
                                              Working with Formulas and Functions
                                             This formula eliminates the need for the IF function and takes advantage of the fact that:
                                                  TRUE * 1 = 1
                                             and
                                                  FALSE * 1 = 0
                                       FIGURE 17.16
                                      An array formula returns the number of text cells in the range.
                                             Eliminating intermediate formulas
                                             One key benefit of using an array formula is that you can often eliminate intermediate formulas in your
                                             worksheet, which makes your worksheet more compact and eliminates the need to display irrelevant calcu-
                                             lations. Figure 17.17 shows a worksheet that contains pre-test and post-test scores for students. Column D
                                             contains formulas that calculate the changes between the pre-test and the post-test scores. Cell D17 con-
                                             tains a formula, shown here, that calculates the average of the values in column D:
                                                  =AVERAGE(D2:D15)
                                             With an array formula, you can eliminate column D. The following array formula calculates the average of
                                             the changes but does not require the formulas in column D:
                                                  {=AVERAGE(C2:C15-B2:B15)}
                                             How does it work? The formula uses two arrays, the values of which are stored in two ranges (B2:B15 and
                                             C2:C15). The formula creates a new array that consists of the differences between each corresponding ele-
                                             ment in the other arrays. This new array is stored in Excel’s memory, not in a range. The AVERAGE function
                                             then uses this new array as its argument and returns the result.
                                             The new array consists of the following elements:

                                                  {11,15,-6,1,19,2,0,7,15,1,8,23,21,-11}
                                             The formula, therefore, is reduced to
                                                  =AVERAGE({11,15,-6,1,19,2,0,7,15,1,8,23,21,-11})
                                             Excel evaluates the function and displays the results, 7.57.








                                      330
   368   369   370   371   372   373   374   375   376   377   378