Page 295 - Excel 2007 Bible
P. 295

19_044039 ch14.qxp  11/21/06  11:06 AM  Page 252
                                   Part II
                                              Working with Formulas and Functions
                                                             About This Chapter’s Examples
                                             ost of the examples in this chapter use named ranges for function arguments. When you adapt these for-
                                         Mmulas for your own use, you’ll need to substitute either the actual range address or a range name
                                         defined in your workbook.
                                         Also, some examples consist of array formulas. An array formula is a special type of formula that enables you
                                         to perform calculations that would not otherwise be possible. You can spot an array formula because it’s
                                         enclosed in curly brackets when it’s displayed in the Formula bar. In addition, I use this syntax for the array
                                         formula examples presented in this book. For example:
                                         {=Data*2}
                                         When you enter an array formula, press Ctrl+Shift+Enter (not just Enter) and don’t type the brackets. (Excel
                                         inserts the brackets for you.) If you need to edit an array formula, don’t forget to use Ctrl+Shift+Enter when
                                         you’ve finished editing (otherwise, the array formula will revert to a normal formula and it will return an
                                         incorrect result). Refer to Chapter 17 for an introduction to array formulas.
                                             Counting the total number of cells
                                             To get a count of the total number of cells in a range (empty and non-empty cells), use the following for-
                                             mula. This formula returns the number of cells in a range named Data. It simply multiplies the number of
                                             rows (returned by the ROWS function) by the number of columns (returned by the COLUMNS function).
                                                  =ROWS(Data)*COLUMNS(Data)
                                             This formula will not work if the Data range consists of noncontiguous cells. In other words, Data must be a
                                             rectangular range of cells.
                                             Counting blank cells
                                             The following formula returns the number of blank (empty) cells in a range named Data:
                                                  =COUNTBLANK(Data)
                                             The COUNTBLANK function also counts cells containing a formula that returns an empty string. For exam-
                                             ple, the formula that follows returns an empty string if the value in cell A1 is greater than 5. If the cell meets
                                             this condition, the COUNTBLANK function counts that cell.
                                                  =IF(A1>5,””,A1)
                                             You can use the COUNTBLANK function with an argument that consists of entire rows or columns. For
                                             example, this next formula returns the number of blank cells in column A:
                                                  =COUNTBLANK(A:A)
                                             The following formula returns the number of empty cells on the entire worksheet named Sheet1. You must
                                             enter this formula on a sheet other than Sheet1, or it will create a circular reference.
                                                  =COUNTBLANK(Sheet1!1:1048576)






                                      252
   290   291   292   293   294   295   296   297   298   299   300