Advertisement
bousaid

IRG 2022_H VBA

Jan 8th, 2022 (edited)
1,511
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' IRG 2022 Function By Boussaid Mustafa
  2. ' APC SALI 2022
  3. ' Normal + Handicape
  4. ' Usage:
  5. '---->Normal
  6. ' =IRG2022_New(1;A1)
  7. '---->Handicape
  8. ' =IRG2022_New(2;A1)
  9. Function IRG2022_New(TypeIRG, moTr) As Double
  10.  
  11. moTr = Int(moTr / 10) * 10
  12. If moTr <= 30000 Then
  13.     IRG2022_New = 0
  14. Else
  15.     Select Case moTr
  16.         Case 30010 To 40000: IRG2022_New = (moTr - 20000) * 0.23
  17.         Case 40001 To 80000: IRG2022_New = 4600 + (moTr - 40000) * 0.27
  18.         Case 80001 To 160000: IRG2022_New = 15400 + (moTr - 80000) * 0.3
  19.         Case 160001 To 320000: IRG2022_New = 39400 + (moTr - 160000) * 0.33
  20.         Case Is > 320000: IRG2022_New = 92200 + (moTr - 320000) * 0.35
  21.         Case Else: IRG2022_New = 0
  22.     End Select
  23.  
  24.     Dim abat As Double
  25.     abat = IRG2022_New * 0.4
  26.     If abat < 1000 Then abat = 1000
  27.     If abat > 1500 Then abat = 1500
  28.     IRG2022_New = IRG2022_New - abat
  29.    
  30.     '1= Normal 2= Handicape
  31.     Select Case TypeIRG
  32.         Case 1 '---->Normal
  33.             If moTr < 35000 Then
  34.                 IRG2022_New = (IRG2022_New * 137 / 51) - (27925 / 8)
  35.             End If
  36.         Case 2 '---->Handicape
  37.             If moTr < 42500 Then
  38.                 IRG2022_New = (IRG2022_New * 93 / 61) - (81213 / 41)
  39.             End If
  40.     End Select
  41.     IRG2022_New = Round(IRG2022_New, 1)
  42. End If
  43. End Function
Advertisement
RAW Paste Data Copied
Advertisement