Image : http://www.flickr.com
Writing custom functions in Excel is simple and important because everyone needs to perform a calculation specific to their situation from time to time. Some companies may offer a special bonus for their employees, while other companies can offer more travel allowances or benefits of Christmas. Using the standard features available in Microsoft Excel can not provide the solution. The solution is to create your own function.
custom features such as macros, use theVisual Basic for Applications (VBA) programming language. They differ from macros in two significant ways. First, use function procedures instead of sub procedures. They start with a function declaration instead of a statement and ends with End Sub Function instead of End Sub. Second, perform calculations, instead of taking actions.
A custom function is more flexible since no real data is hard coded in the first function, the user just types of datathe calculation instead of the actual calculation. We see one in action.
To create this custom function, follow these steps:
1. Start Microsoft Excel.
2. Click on 'Tools' in the menu bar, select Macro and then click on 'Visual Basic Editor' or simply press 'Alt + F11' to start the Visual Basic Editor
3. On the Insert menu, click Module.
4. Type the following code in the new module:
Function paypackage (salary)
'HouseRent Allowance (HRA)
'HRA = 60% of basic salary
'Leave travel allowance (LTA)
'LTA = 8.33% of basic salary
Paypackage salary + = salary * 0.6 + salary * 0,0,833 thousand
End Function
To use the custom function, follow these steps:
1. Type the following values in the worksheet:
The value of the cell
--------------
A3 7000.00
Paypackage B3 = (A3)
The value in cell A3 is a basic salary of the employee.
This functionautomatically calculates the paypackage an employee on the basis of basic salary and the result appears immediately 11783.1.
Such interesting features can be created to calculate compound interest using:
Compound_Interest Function (PV As Double, R As Double, N As Double) As Double
Compound_Interest = PV * (1 + R), Calculates ^ N '
End Function
In the above function PV is the present value, R is the interest rate, and N is the number ofinvestment periods.
Be careful!
No comments:
Post a Comment