- الكود:
Function irgne(x As Double) As Double
Dim r1, r2, k As Double
x = (Int(x / 10)) * 10
If x <= 30000 Then
irgne = 0
Else
'---------------Part1------------------
r1 = Round( _
IIf(x <= 40000, (x - 20000) * 0.23, _
IIf(x <= 80000, (x - 40000) * 0.27 + 4600, _
IIf(x <= 160000, (x - 80000) * 0.3 + 15400, _
IIf(x <= 320000, (x - 160000) * 0.33 + 39400, _
(x - 320000) * 0.35 + 92200)))), 1)
'---------------Part2----------------
k = r1 * 0.4
r2 = _
IIf(Round(k, 2) > 1500, Round(r1 - 1500, 1), _
IIf(Round(k, 2) < 1000, Round(r1 - 1000, 1), _
Round(r1 * 0.6, 1)))
'---------------Part3----------------
irgne = Round(IIf(x <= 35000, Round(r2 * 137 / 51 - 27925 / 8, 1), r2), 1)
End If
End Function