Question: I need a macro to calculate total cost based on a multi-tier fee structure. For example,
How can I do this? Answer: This can be accomplished with a VBA function. Let's take a look at an example. Download Excel spreadsheet (as demonstrated below)
|
||||||||||||||||||
At the top of Sheet1, we've entered the fee structure amount and percentages (rows 3-7). Then we've created a function called CalcCost that accepts the fees as a parameter and returns the calculated cost based on those fees. In our example, we're calculating the cost based on a fee amount of $13,800,00. The function makes the following calculations:
The function then returns $249,500 as the result. You can press Alt-F11 to view the VBA code. |
||||||||||||||||||
Macro Code:The macro code looks like this:
|
Visit our busy book shop, were you can find latest books for beginners as well as advanced excel users.
Spreadsheet 123 Spreadsheet Software Development
See Spreadsheets for:
a.Hotel Management b.Personal Budget
c.Corporate Finance d.Rating Calculation e.Real Estate and Mortgage
f.Web Calc