Page 178 - Excel Progamming Weekend Crash Course
P. 178

k540629 ch12.qxd  9/2/03  9:34 AM  Page 153




                  Session 12 — Programming with Custom Formulas                          153


               Table 12-1  Relative versus Absolute Cell References

               Formula in cell A2              When copied to cell D6
               =A1                             =D5
               =$A$1                           =$A$1
               =$A1                            =$A5
               =A$1                            =D$1


                  Here’s an example of using absolute cell references. The goal is to create a table that cal-
               culated the volume of differently sized cylinders. Different values for the cylinder radius are
               listed down the left side of the table, and different values for its height are listed across the
               top. In each cell, the volume for the corresponding radius and height is displayed. The for-
               mula for cylinder volume is:
                  πr h
                    2
                   π is the geometric constant “pi,” approximately 3.1416.
                   r is the radius of the cylinder.
                   h is the height of the cylinder.
                  Now, look at the worksheet in Figure 12-1. What would the required formula be for the
               top left cell of results (cell C5)? In pseudocode it would be:
                  (pi) times (cell B5 squared) times (cell C4)























                    Figure 12-1 A table that uses part absolute cell references for its calculations
   173   174   175   176   177   178   179   180   181   182   183