Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Select Statement

Status
Not open for further replies.

penndro

Technical User
Jan 9, 2005
108
US
I could use some help here with this small function. Checked all of my variable names so I am not sure where the zero in the results are coming from.

Public Function GetTaxTable(TotalComp As Double, TargetComp As Double) As Double

Dim LTIPercent As Integer


Select Case [TotalComp]
Case 100000 To 249999
LTIPercent = 0.07
Case 250000 To 499999
LTIPercent = 0.1
Case 500000 To 749999
LTIPercent = 0.15
Case 750000 To 999999
LTIPercent = 0.25
End Select

If [TotalComp] > [TargetComp] * 1.2 Then

GetTaxTable = LTIPercent * [TotalComp]

Else: GetTaxTable = 0

End If
End Function
 

hi,

Please post how you call this function.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


BTW, change your declaration to something other than an INTEGRAL data type...
Code:
    Dim LTIPercent As Single


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 

What if TotalComp is greater than 999999?

Better logic...
Code:
    Select Case TotalComp
        Case Is >= 750000
            LTIPercent = 0.25
        Case Is >= 500000
            LTIPercent = 0.15
        Case Is >= 250000
            LTIPercent = 0.1
        Case Is >= 100000
            LTIPercent = 0.07
        Case Else
            LTIPercent = 0
    End Select


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top