您的位置首页百科知识

用YEAR函数怎么计算Excel年龄

用YEAR函数怎么计算Excel年龄

D2格

=N(YEAR(TODAY())-YEAR(C2)-IF(MONTH(TODAY())-MONTH(C2)-IF(DAY(TODAY())-DAY(C2)<0,1,0)<0,1,0))

说明:

N()

将日期转成数值

YEAR(TODAY())-YEAR(C2)

用今天的年份减去出生的年份

IF(MONTH(TODAY())-MONTH(C2)-IF(DAY(TODAY())-DAY(C2)<0,1,0)<0,1,0)

生日没到则年龄减1