SOLVED

# calculating dob for daycare list when child isn't born yet

Occasional Contributor

# calculating dob for daycare list when child isn't born yet

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...

Beth

5 Replies

# Re: calculating dob for daycare list when child isn't born yet

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)")

# Re: calculating dob for daycare list when child isn't born yet

Both work to give me the year, month, days BUT neither work if the child isn't born yet. If the child isn't born till lets say October 13, 2022 then I'm still getting the #NUM! error

# Re: calculating dob for daycare list when child isn't born yet

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)")

best response confirmed by BBacon621 (Occasional Contributor)
Solution

# Re: calculating dob for daycare list when child isn't born yet

@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)

# Re: calculating dob for daycare list when child isn't born yet

thank you that worked!