Sep 23 2021 10:06 AM
I have a spreadsheet that calculates the DOB of a child based on todays date and DOB - what do I do if it's also a waiting list because the child isn't born yet? I get a #NUM! error. I'm thinking it would be an IF statement but not sure how to get it to say "0" in the DOB field and change to the right age once the child is born????
this is my formula so far:
=DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s)"
gives me the correct age in years & months - if the child isn't born yet I'd like it to say "0 years, 0 months" and then change once the child is born to say "0 years, 0 months, 1 day" etc. Is that even possible? It's okay if it uses years, months, days for all the children if it has to be all or nothing...
please help - I love excel but don't understand a lot about manipulating complex formulas
Beth
Sep 23 2021 10:59 AM
For example:
=IF(B2="","Not born yet",DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s), "&TODAY()-EDATE(B2,DATEDIF(B2,TODAY(),"m"))&" day(s)")
or
=IF(B2="","0 years, 0 months, 0 days",DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s), "&TODAY()-EDATE(B2,DATEDIF(B2,TODAY(),"m"))&" day(s)")
Sep 23 2021 11:53 AM
Sep 23 2021 12:29 PM
How do you know the DOB if the child isn't born yet? Anyway, try
=IF(B2>TODAY(),"0 years, 0 months, 0 days",DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s), "&TODAY()-EDATE(B2,DATEDIF(B2,TODAY(),"m"))&" day(s)")
Sep 24 2021 06:21 AM
Solution@BBacon621 , just wrap your existing formula with the IFERROR formula,
=IFERROR(DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s)",0)
Sep 24 2021 09:18 AM
Sep 24 2021 06:21 AM
Solution@BBacon621 , just wrap your existing formula with the IFERROR formula,
=IFERROR(DATEDIF(B2,TODAY(),"y")&" year(s), "&MOD(DATEDIF(B2,TODAY(),"m"),12)&" month(s)",0)