Wednesday, May 27, 2009

Commissions Payment in VBA when a salesman attain a sale volume

when a salesman attain a sale volume of $6000, he will be paid $6000x15%=$720.00. A visual basic function to calculate the commissions can be written as follows:

Function Comm(Sales_V As Variant) as Variant

If Sales_V <500 Then
Comm=Sales_V*0.03
Elseif Sales_V>=500 and Sales_V<1000 Then
Comm=Sales_V*0.06
Elseif Sales_V>=1000 and Sales_V<2000 Then
Comm=Sales_V*0.09
Elseif Sales_V>=200 and Sales_V<5000 Then
Comm=Sales_V*0.12
Elseif Sales_V>=5000 Then
Comm=Sales_V*0.15
End If

End Function

No comments:

Post a Comment