Page 242 - Excel 2007 Bible
P. 242

16_044039 ch11.qxp  11/21/06  11:04 AM  Page 199
                                                                                       Introducing Formulas and Functions
                                             Using Advanced Naming Techniques
                                             Using range names can make your formulas easier to understand, easier to modify, and even help prevent
                                             errors. It’s much easier to deal with a meaningful name such as AnnualSales than with a range reference
                                            such as AB12:AB68.
                                                       See Chapter 5 for basic information regarding working with names.
                                      CROSS-REF
                                      CROSS-REF
                                             Excel offers a number of advanced techniques that make using names even more useful. I discuss these
                                             techniques in the sections that follow.
                                             Using names for constants
                                             Many Excel users don’t realize that you can give a name to an item that doesn’t appear in a cell. For exam-
                                             ple, if formulas in your worksheet use a sales-tax rate, you would probably insert the tax-rate value into a
                                             cell and use this cell reference in your formulas. To make things easier, you would probably also name this
                                             cell something similar to SalesTax.
                                             Here’s how to provide a name for a value that doesn’t appear in a cell:
                                                 1. Choose Formulas ➪ Defined Names ➪ Define Name. Excel displays the New Name dialog  11
                                                    box.
                                                 2. Enter the name (in this case, SalesTax) into the field labeled Name.
                                                 3. Select a scope in which the name will be valid (either the entire workbook or a specific
                                                    worksheet).
                                                 4. Click the Refers To box, delete its contents, and replace the old contents with a value (such
                                                    as .075).
                                                 5. Use the Comment box to provide a comment about the name (optional).
                                                 6. Click OK to close the New Name dialog box and create the name.
                                             You just created a name that refers to a constant rather than a cell or range. Now if you type =SalesTax into
                                             a cell that’s within the scope of the name, this simple formula returns 0.075 — the constant that you
                                            defined. You also can use this constant in a formula, such as =A1*SalesTax.
                                           TIP         A constant also can be text. For example, you can define a constant for your company’s name.
                                           TIP
                                          NOTE
                                          NOTE         Named constants don’t appear in the Name box or in the Go To dialog box. This makes sense
                                                       because these constants don’t reside anywhere tangible. They do appear in the drop-down list
                                            that’s displayed when you enter a formula — which is handy because you use these names in formulas.
                                             Using names for formulas
                                             Just as you can create a named constant, you can also create named formulas. As with named constants,
                                             named formulas don’t appear in the worksheet.
                                             You create named formulas the same way you create named constants — by using the New Name dialog
                                             box. For example, you might create a named formula that calculates the monthly interest rate from an
                                             annual rate; Figure 11.16 shows an example. In this case, the name MonthlyRate refers to the following
                                            formula:
                                                 =Sheet1!$B$1/12
                                                                                                                      199
   237   238   239   240   241   242   243   244   245   246   247