标签:计算 单元 时间 当前时间 date code mon 替换 pre
假设身份证号在A2单元格
=IF(MONTH(NOW())<MONTH(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))),INT(YEAR(NOW())-YEAR(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))))-1,IF(MONTH(NOW())>MONTH(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))),YEAR(NOW())-YEAR(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))),IF(DAY(NOW())>=DAY(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))),YEAR(NOW())-YEAR(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2))),YEAR(NOW())-YEAR(DATE(MID(A2,7,4),MID(A2,11,2),MID(A2,13,2)))-1)))
其实也可以根据任意时期计算, 例如, 只需将NOW()
替换为"2018-08-08"
标签:计算 单元 时间 当前时间 date code mon 替换 pre
原文地址:https://www.cnblogs.com/xiangnan/p/10231904.html