Function Datediff_AMJ$(ByVal dat1, Optional ByVal dat2 = 0)
Dim a%, m%, j%, dtemp As Date, Erreur$
If dat2 = 0 Then dat2 = Date
Erreur = IIf(Not IsDate(dat1), "(1)", ""): Erreur = Erreur & IIf(Not IsDate(dat2), "(2)", ""): Erreur = IIf(Erreur <> "", "Invalid Argmt(" & Erreur & ")", "")
If Erreur <> "" Then Datediff_AMJ = Erreur: Exit Function
dat1 = CDate(dat1): dat2 = CDate(dat2)
If dat1 > dat2 Then dtemp = dat1: dat1 = dat2: dat2 = dtemp
a = Evaluate("DATEDIF(" & CDbl(dat1) & "," & CDbl(dat2) & ",""y"")")
m = Evaluate("DATEDIF(" & CDbl(dat1) & "," & CDbl(dat2) & ",""ym"")")
j = Abs(DateSerial(Year(dat1) + a, Month(dat1) + m, Day(dat1)) - dat2)
Datediff_AMJ = RTrim(IIf(a, a & " an" & IIf(a = 1, " ", "s "), "") & IIf(m, m & " mois ", "") & IIf(m Or a, IIf(j > 0, "et ", ""), "") & IIf(j, j & " jour" & IIf(j = 1, "", "s"), ""))
End Function