Advertisement
bousaid

Auto Calc: INDIC 2008/2022/2023/2024 VBA

Jan 27th, 2023 (edited)
2,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
thinBasic 1.71 KB | Source Code | 0 0
  1. ' Fonction Saler + IEP By Boussaid Mustafa
  2. ' APC SALI 2023
  3. ' Usage:
  4. ' =Indic(A1;2023)
  5. ' =IepIndic(A1;A2;2023)
  6. Function Indic(Categori As Integer, nYear As Integer)
  7.     Dim val As Integer
  8.     Dim nFirst As Integer
  9.     If Categori >= 11 And Categori <= 17 Then
  10.         val = 18
  11.     ElseIf Categori >= 9 And Categori <= 10 Then
  12.         val = 10
  13.     ElseIf Categori >= 7 And Categori <= 8 Then
  14.         val = 4
  15.     Else
  16.         val = 0
  17.     End If
  18.     Select Case nYear
  19.         Case 2008: nFirst = 200
  20.         Case 2022: nFirst = 250
  21.         Case 2023: nFirst = 325
  22.         Case 2024: nFirst = 400
  23.     End Select
  24.     Indic = val + (Categori - 1) * 19 + nFirst + (Categori - 2) * (Categori - 1)
  25. End Function
  26.  
  27. ' Fonction Saler + IEP By Boussaid Mustafa
  28. ' APC SALI 2023
  29. Function IepIndic(Categori As Integer, Echlon As Integer, nYear As Integer)
  30.     Dim IndiceCategorie As Integer
  31.     IndiceCategorie = Indic(Categori, nYear)
  32.     IepIndic = Round(IndiceCategorie * 0.05 * Echlon, 0)
  33.     If nYear = 2008 Then
  34.         If Categori = 8 And Echlon = 12 Then
  35.             IepIndic = IepIndic - 2
  36.         End If
  37.     End If
  38.     If nYear = 2022 Then
  39.         Dim nPlus As Integer
  40.         Select Case Echlon
  41.             Case 1: nPlus = 3
  42.             Case 2: nPlus = 5
  43.             Case 3: nPlus = 8
  44.             Case 4: nPlus = 10
  45.             Case 5: nPlus = 13
  46.             Case 6: nPlus = 15
  47.             Case 7: nPlus = 18
  48.             Case 8: nPlus = 20
  49.             Case 9: nPlus = 23
  50.             Case 10: nPlus = 25
  51.             Case 11: nPlus = 28
  52.             Case 12: nPlus = 30
  53.             Case Else: nPlus = 0
  54.         End Select
  55.         IepIndic = IepIndic(Categori, Echlon, 2008) + nPlus
  56.     End If
  57. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement