步骤:
首先选中年龄的列。
然后在函数框中输入:
=YEAR(TODAY())-YEAR(A1)+IF(OR(MONTH(A1)-MONTH(TODAY())<0,AND(MONTH(A1)-MONTH(TODAY())=0,DAY(A1)-DAY(TODAY())<=0)),1,0)
年龄自动更新用一个datedif函数就可以了,其它的按你需要做。
=datedif("出生年月",today(),"y")
=YEAR(TODAY())-YEAR(A1)+IF(OR(MONTH(A1)-MONTH(TODAY())<0,AND(MONTH(A1)-MONTH(TODAY())=0,DAY(A1)-DAY(TODAY())<=0)),1,0)
此处A列设定单元格格式为日期型,输入员工出生日期,年龄列设定单元格格式为数值型,小数位数为0
如果A列为身份证号码:
=YEAR(TODAY())-MIDB(A1,7,4)+IF(OR(MIDB(A1,11,2)-MONTH(TODAY())<0,AND(MIDB(A1,11,2)-MONTH(TODAY())=0,MIDB(A1,13,2)-DAY(TODAY())<=0)),1,0)
可根据你的要求制作,如有兴趣了解的话可以HI我