首先输入等于datedif括号点击入职时间单元格,括号再输入逗号再输入today补齐括号,双引号里面输入y,结尾括号,回车确定即可完成。
假设,A1中为:2010-9-1,B1中为:2013-6-5,则:
=DATEDIF(A1,B1,"y")&"年"&DATEDIF(A1,B1,"ym")&"月"
或者,直接写也可以:
=DATEDIF("2010-9-1","2013-6-5","y")&"年"&DATEDIF("2010-9-1","2013-6-5","ym")&"月"
Excel表格如何计算工龄?这个视频告诉你!
设入职日期在a2单元格,在b2输入:
=INT(DATEDIF(A2,TODAY(),"m")/12)&"年零"&MOD(DATEDIF(A2,TODAY(),"m"),12)&"月"
上面这个是已当前日期来进行计算的。如果一定要用”2013-6-5“这个日期的话,用下面的公式:
=INT(DATEDIF(A2,"2013-6-5","m")/12)&"年零"&MOD(DATEDIF(A2,"2013-6-5","m"),12)&"月"