• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 32. Creating Custom Functions > Using Custom Functions

Using Custom Functions

Now you're ready to use the new Discount function. Press Alt+F11 to switch back to the worksheet shown in Figure 32-1. Select cell F9 and enter =Discount(C9,D9). Excel calculates the 10 percent discount on 200 units at $47.50 per unit and returns $950.00.

In the first line of your VBA code, Function Discount(quantity, price), you indicated that the Discount function would require two arguments, quantity and price. When you call the function in a worksheet cell, you must include those two arguments. In the formula =Discount(C9,D9), C9 is the quantity argument, and D9 is the price argument. Now you can copy the discount formula into F10:F15 to get the worksheet shown in Figure 32-3.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint