HR必学的日期处理函数-DATEDIF
相差年数(Y):=DATEDIF(A2,B2,"Y")
相差月数(M):=DATEDIF(A2,B2,"M")
相差天数(D):=DATEDIF(A2,B2,"d")
=YEAR(B2)-YEAR(A2)-1+(DATE(YEAR(B2),MONTH(A2),DAY(A2))<=B2)
=(YEAR(B2)-YEAR(A2))*12+MONTH(B2)-MONTH(A2)-(B2-A2< (TEXT(B2,"yyyy-m-\1")-TEXT(A2,"yyyy-m-\1")))*1
=B2-A2
=TEXT(20-DATEDIF(B2-20,TODAY(),"yd"),"0天后生日;;今天生日;")
=TEXT(SUM(DATEDIF(B2,TODAY(),{"y","ym","md"})*10^{4,2,0}),"0年00月00天")
=DATEDIF(B2,TODAY(),"Y")&"年"&DATEDIF(B2,TODAY(),"ym")&"月" &DATEDIF(B2,TODAY(),"md")&"日"
赞 (0)