Bonjour,
Je ne suis pas une pro des macro, pourriez-vous svp m'aider à convertir le langage VBA en formule Excel :
1-
IF [fin] < "2021-01-01"
THEN DateTimeDiff([fin],[debut],"days")/30
ELSE DateTimeDiff("2020-12-31",[debut],"days")/30
ENDIF
IF [duree_cumul_amort]<=0
THEN 0
ELSE [duree_cumul_amort]
ENDIF
2-
IF [debut] > "2021-01-01" and [fin] < "2022-01-01"
THEN DateTimeDiff([fin],[debut],"days")/30
ELSEIF [fin] < "2022-01-01"
THEN DateTimeDiff([fin],"2021-01-01","days")/30
ELSEIF [debut] > "2021-01-01"
THEN DateTimeDiff("2021-12-31",[debut],"days")/30
ELSE DateTimeDiff("2021-12-31","2021-01-01","days")/30
ENDIF
3-
IF [debut] > "2021-01-01" and [fin] < "2022-01-01"
THEN DateTimeDiff([fin],[debut],"days")/30
ELSEIF [fin] < "2022-01-01"
THEN DateTimeDiff([fin],"2021-01-01","days")/30
ELSEIF [debut] > "2021-01-01"
THEN DateTimeDiff("2021-12-31",[debut],"days")/30
ELSE DateTimeDiff("2021-12-31","2021-01-01","days")/30
ENDIF
et
IIF([MT_TCC_FIN_INIT]-[cumul_amort_PBF]=0,0,((MT_TCC_FIN_INIT)/48)*[duree_dotation_2021])
Merci par avance pour votre aide
Cordialement