Page 757 - Excel 2013 All-in-One For Dummies
P. 757

Creating Custom Excel Functions 739
 Figure 2-8 shows a worksheet that contains a table with the April 2013
RV sales for three salespeople: Fred, Holly, and Jack. As you can see, the Automatic Subtotals feature (covered in Book VI, Chapter 1) has been used to compute both the monthly total sales (with the SUM function) and the number of sales (with the COUNT function) for each of these three salespeople.
  Figure 2-8:
Selecting a cell in the RV Sales spreadsheet into which to enter the Commission function.
 To calculate the April monthly commissions for each salesperson in this table, you select the cell where you want the first commission to be calculated (Fred’s commission in cell E5). Click the Insert Function button on the Formula bar and then click User Defined at the very bottom of the Or Select a Category drop-down list. Doing this displays the PERSONAL.XLSB!Commission custom function in the Select a Function list box.
When you click OK after selecting the PERSONAL.XLSB!Commission func- tion in the Insert Function dialog box, the Function Arguments dialog box appears, shown in Figure 2-9. Here, you select cell C4 with Fred’s total sales amount for April as the TotalSales argument and cell C5 with the number of sales made in that month as the ItemsSold argument.
 Book VIII Chapter 2
 VBA Programming


























































































   755   756   757   758   759