View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Chuck[_11_] Chuck[_11_] is offline
external usenet poster
 
Posts: 58
Default Result in 3rd function from existing two functions

On Wed, 15 Apr 2009 07:25:01 -0700, Patrick Molloy
wrote:

Function c(TotalIncomePerAnnum)
Dim a As Double
Dim b As Double
a = FlatRateTax(TotalIncomePerAnnum)
b = MarginalReliefTax(TotalIncomePerAnnum)
c = Iff(b <= a, b, a)
End Function

"shabutt" wrote:

Thank you Sir for your quick response and guidance. Here is my full code:

Function FlatRateTax(TotalIncomePerAnnum)
Select Case TotalIncomePerAnnum
Case Is 8650000: FlatRateTax = WorksheetFunction.Round(TotalIncomePerAnnum
* 0.2, 0)
Case Is 4550000: FlatRateTax = WorksheetFunction.Round(TotalIncomePerAnnum
* 0.19, 0)
Case Is 3550000: FlatRateTax = WorksheetFunction.Round(TotalIncomePerAnnum
* 0.185, 0)

Huge Snip
Case Is 250000: FlatRateTax = WorksheetFunction.Round(TotalIncomePerAnnum
* 0.0075, 0)
Case Is 180000: FlatRateTax = WorksheetFunction.Round(TotalIncomePerAnnum
* 0.005, 0)
Case Is 0: FlatRateTax = TotalIncomePerAnnum * 0
End Select
End Function

Function MarginalReliefTax(TotalIncomePerAnnum)
Select Case TotalIncomePerAnnum
Case Is 8650000: MarginalReliefTax = WorksheetFunction.Round((8650000 *
0.19) + (TotalIncomePerAnnum - 8650000) * 0.6, 0)
Case Is 4550000: MarginalReliefTax = WorksheetFunction.Round((4550000 *
0.185) + (TotalIncomePerAnnum - 4550000) * 0.6, 0)
Case Is 3550000: MarginalReliefTax = WorksheetFunction.Round((3550000 *
0.175) + (TotalIncomePerAnnum - 3550000) * 0.5, 0)

Huge Snip
Case Is 250000: MarginalReliefTax = WorksheetFunction.Round((250000 *
0.005) + (TotalIncomePerAnnum - 250000) * 0.2, 0)
Case Is 180000: MarginalReliefTax = WorksheetFunction.Round((180000 * 0) +
(TotalIncomePerAnnum - 180000) * 0.2, 0)
Case Is 0: MarginalReliefTax = TotalIncomePerAnnum * 0
End Select
End Function

Function MontlyTax(TotalIncomePerAnnum) As Integer
MontlyTax = WorksheetFunction.Min(FlatRateTax(TotalIncomePerAn num),
MarginalReliefTax(TotalIncomePerAnnum))
End Function

This example has been taken from "Excel 2007 Macros Made Easy". Thanks again
for your answer and advice. I will keep in mind.

Regards.


I don't know the author(s) of "Excel 2007 Macros Made Easy", but the functions
you show are anything but a <Flat Rate Tax. In fact they are a geometrically
progressive tax. If the function 'MonthlyTax()' is correct, then anyone who
has a yearly income of more than $1,000,000 a year will owe more taxes than
their total income. If 'MonthlyTax should be YearlyTax, it is a whole lot
better, but still a highly progressive tax schedule. And there are large
discontinuities in the curve of taxes vs income.

A flat tax is *flat*. Tax = income * rate. Where rate is a constant.

Chuck