This isn't elegant, but it should work:
Function InsuranceFee(ByVal declaredValue As Double) As Double
If declaredValue <= 100 Then Return 0
Dim dblTemp As Double = 0
dblTemp = 0.6 * declaredValue / 100
If dblTemp < 1.8 Then dblTemp = 1.8
dblTemp = Math.Round(dblTemp, 2) 'round to nearest cent
Return dblTemp
End Function
You might need to change the variable type from Double to Decimal or
whatever you are using.
--
David Streeter
Synchrotech Software
Sydney Australia
"Terry Olsen" wrote:
I'm trying to calculate insurance fees for declared value rates. The
definition in the rate guide states this:
Declared Value Insurance Fee
<= $100.00 $0.00
$100 $0.60 for each $100 of the total value declared, with
a minimum charge of $1.80.
So here's the first few ranges:
0-100:0
100.01-300:1.80
300.01-400:2.40
400.01-500:3.00
I'm at a loss on creating a formula to figure this. Can anyone help?
*** Sent via Developersdex http://www.developersdex.com ***