» Create a Custom Function
CATEGORY - Custom Functions
VERSION - All Microsoft Excel Versions
Custom Function ExampleCreate a function named SalesTax to calculate the amount of Sales Tax (or VAT tax) included in the total amount line in an invoice.
The function has two argument boxes.
The function:
Type the code below into a regular Module sheet (read more on VBE & a Module sheet in Tip #19).
Function SalesTax (Total_Invoice, Tax_percentage) As Single
SalesTax = Total_Invoice – Total_invoice / (1+Tax_percentage)
End Function
Note: The SalesTax macro can be downloaded from www.exceltip.com/f1toc.
The formula structure is:
Function name = SalesTax
The Function arguments are placed in parentheses; the above example has two argument boxes.
The last piece of the formula, As Single, defines the value type of the result returned by the Function (a number with two decimal places in this case).
The Function receives the results of the calculation and returns the result to the cell.
Activating the function:
1. Type the total invoice into cell B2 and the tax percentage into cell B3.
2. Select cell D2, and then press Shift+F3 to open the Paste Function dialog box.
3. Select the User Defined category, and then select the SalesTax Function.
4. In the first argument box, select cell B2, and in the second argument box, select cell B3.
5. Click OK.

Book Store:
Recommended Books:
- Who Moved My Cheese? An Amazing Way to Deal with Change in Your Work and in Your Life
- Final Accounting: Ambition, Greed and the Fall of Arthur Andersen
- Accounting the Easy Way
- Financial Reporting and Analysis (2nd Edition)
- Rich Dad, Poor Dad: What the Rich Teach Their Kids About Money--That the Poor and Middle Class Do Not!
- Not-for-Profit Accounting Made Easy
No comments have been submitted.

