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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with String Functions

Status
Not open for further replies.

jessedh

MIS
Apr 16, 2002
96
US
Hi, I have a bit of code that performs a commission calculation. My boss now wants me to build an explnantion field that will explain how the commission was calculated. This seemed not too hard, more time consuming, but i have run up against a roadblock.

Private Function ScheduleBExplanation(BBPerc As Double, NoteAmount As Double, _
SUMNA As Double, HUD801 As Double, Hud808 As Double) As Variant
'Calcs Schedule B
Dim Tier1 As Double
Dim Tier2 As Double
Dim Tier3 As Double
Dim Tier4 As Double

SUM800 = HUD801 + Hud808

Overage800 = SUM800 - 1

If SUM800 <= 1 Then
Tier1 = SUM800 - 5
Tier2 = (Tier1 / 100) * NoteAmount
ScheduleBExplanation = &quot;(((&quot; & Left(SUM800, 1) & &quot;.&quot; & Right(SUM800, Len(SUM800) - InStr(SUM800, &quot;.&quot;)) & &quot; - .5)/100) *&quot; & NoteAmount
.......
This should return something that looks like this (0.75 - .5)/100) * 500000

but just returns (0.0 - .5)/100 * 500000

Help!
 
Are you sure SUM800 = .75? I get the same thing you do only when SUM800 = 0.

Also, the following is a little more compact and does the same thing.
ScheduleBExplanation = &quot;(((&quot; & CStr(SUM800) & &quot; - .5)/100) *&quot; & NoteAmount
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top