[英]Calculate age in excel
I have a date of birth in excel 23-05-2015(dd/mm/yyyy) and I need to calculate age.I tried the formula =DATEDIF(C3,TODAY(),"Y") but am getting an error as #VALUE!.When I evaluate the formula it shows as =DATEDIF("23/05/2015",42866,"Y"). 我的出生日期是excel 23-05-2015(dd / mm / yyyy),我需要计算年龄。我尝试了公式= DATEDIF(C3,TODAY(),“ Y”),但由于出现错误#VALUE!。当我评估公式时,它显示为= DATEDIF(“ 23/05/2015”,42866,“ Y”)。 I guess it is because of date format (dd/mm/yyyy), is there any method where I can achieve this.
我猜是因为日期格式(dd / mm / yyyy),有什么方法可以实现这一点。
Simply write =Today-C3
and then press Ctrl+1
and select Number
for the format. 只需编写
=Today-C3
,然后按Ctrl+1
并选择Number
作为格式。 The answer is in days. 答案是几天之内。
Or try like this: 或者尝试这样:
=DATEDIF(DATE(YEAR(A24),MONTH(A24),DAY(A24)),TODAY(),"Y")
You need to convert string to date inside DATEDIF()
: 您需要在
DATEDIF()
字符串转换为日期:
=DATEDIF(DATE(RIGHT(A1,4),MID(A1,4,2),LEFT(A1,2)),TODAY(),"y")
And if you love big formulas: 如果您喜欢大公式:
=DATE(RIGHT(A1,LEN(A1)-FIND("@",SUBSTITUTE(A1,"-","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"-","")))))),MID(A1,FIND("-",A1)+1,FIND("@",SUBSTITUTE(A1,"-","@",(LEN(A1)-LEN(SUBSTITUTE(A1,"-","")))))-FIND("-",A1)-1),LEFT(A1,2))
I used the following formula which returned me the correct answer in years. 我使用以下公式,多年来返回了正确答案。
=DATEDIF(DATE1, DATE2, "Y") = DATEDIF(DATE1,DATE2,“ Y”)
You can use the following link to get the required info. 您可以使用以下链接获取必需的信息。
https://exceljet.net/excel-functions/excel-datedif-function https://exceljet.net/excel-functions/excel-datedif-function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.