Hello, I'm trying to include an equation type question that calculates the adjusted age of the respondent's child. I have a question "CurrentAgeMth" that already calculated their chronological age in months (ie. today's date - child's date of birth).
I'd like to calculate their adjusted age if the child is younger than 2 years old and more than 3 weeks premature. If the child isn't premature or if the child is older than 2 years old I'd like CurrentAgeMth to display.
Q10DDate is a List(radio) question to determine if the child was premature (answer option 2).
Q10B4date is a List(radio) question to determine the number of weeks premature.
I've written the following equation but it doesn't work if the child isn't premature (line breaks added for clarity). ie. no value is shown if Q10DDate is not 2.
{if(Q10DDate !=2,CurrentAgeMth,
if((CurrentAgeMth)>24,CurrentAgeMth,
if((CurrentAgeMth)<24 AND (Q10B4date)>2, ((date("Y",(time()))-date("Y",strtotime(Q1dob)))*12+(date("m",(time()))-date("m",strtotime(Q1dob)))+((date("d",(time()))-date("d",strtotime(Q1dob)))/30)-(Q10B4date*(12/52))),CurrentAgeMth)))}
Any idea what I'm writing wrong in the equation?
Thank you all in advance for your help!
The topic has been locked.