You are viewing limited content. For full access, please sign in.

Question

Question

Age calculation error in table

asked on August 17, 2020

I'm trying to do a very simple age calculation in table based on information from this post: https://answers.laserfiche.com/questions/109843/Formula-to-calculate-age-based-on-birthday-within-a-table#109860

The calculation is this, and the variables are correct:  =DATEDIF(INDEX(Household.Birthdate,ROW()),Todays_Date,"y")

The age calculates fine on the first row. But, when I add another row I get a calculation error. When I enter a birthdate on the new row, the error goes away. Why do I get the error when adding a new row? Thank you.

 

AgeCalcError.JPG
AgeCalcError.JPG (34.47 KB)
0 0

Answer

SELECTED ANSWER
replied on August 17, 2020

Seems like the DATEDIF function doesn't like the blank birthdate. You could add an if clause to handle that case...

=IF(INDEX(Household.Birthdate,ROW())="","",(DATEDIF(INDEX(Household.Birthdate,ROW()),Todays_Date,"y")))

That way when birthdate is blank, Age will show 0, once it's filled in, it will show the correct Age. You just need to tell it what to say when birthdate is blank. 

 

1 0

Replies

replied on August 17, 2020

Excellent - thank you!

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.