excel用时间函数计算年龄我很困惑,计算年龄要不要考虑月份的啊?我看到两种答案一是:=YEAR(TODAY())-YEAR(C2);另一种是:=YEAR(TODAY())-YEAR(A2)+IF(MONTH(TODAY())-MONTH(A2)>=0,0,-1)+IF(DAY(TODAY())-DAY(A2)>=0,0,-1)
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 15:42:15
excel用时间函数计算年龄我很困惑,计算年龄要不要考虑月份的啊?我看到两种答案一是:=YEAR(TODAY())-YEAR(C2);另一种是:=YEAR(TODAY())-YEAR(A2)+IF(MONTH(TODAY())-MONTH(A2)>=0,0,-1)+IF(DAY(TODAY())-DAY(A2)>=0,0,-1)
excel用时间函数计算年龄
我很困惑,计算年龄要不要考虑月份的啊?我看到两种答案一是:=YEAR(TODAY())-YEAR(C2);另一种是:=YEAR(TODAY())-YEAR(A2)+IF(MONTH(TODAY())-MONTH(A2)>=0,0,-1)+IF(DAY(TODAY())-DAY(A2)>=0,0,-1);还有其他的表达式;我想知道那种才是正确的,用这两种方法计算出的年龄并不一样.题目是这样要求的使用时间函数,对Sheet中的用户进行年龄计算,而用户的信息是有年月日的比如(1973-03-21);还有这是假定时间是今日的(today),如果题目给出:“假设现在的时间是2008-11-15”又该怎么做呢?
excel用时间函数计算年龄我很困惑,计算年龄要不要考虑月份的啊?我看到两种答案一是:=YEAR(TODAY())-YEAR(C2);另一种是:=YEAR(TODAY())-YEAR(A2)+IF(MONTH(TODAY())-MONTH(A2)>=0,0,-1)+IF(DAY(TODAY())-DAY(A2)>=0,0,-1)
用DATEDIF可以算出年龄是几年、几年几月、几年几月几日,第三参数不同.
=DATEDIF("1973-03-21","2008-11-15","y")&"年"&DATEDIF("1973-03-21","2008-11-15","ym")&"月"&DATEDIF("1973-03-21","2008-11-15","md")&"日"