Calculation field using multiple Qs

Hi all,

I am running into some trouble creating a calculate field for my survey. I want to create one variable that pulls info from 2 questions to output the birth control method of the survey participant at that time.

I ask question 301: Last time we spoke it was right after you received a hormonal IUD, are you still using the hormonal IUD you received that day? The response options to the select one question type are yes (1), no (0), and no response (99). If the participant says no to 301, we ask question 427: What family planning method are you currently using? The response options to the select one question type include a list of all the birth control options.

So if the participant said yes to 301, they are using Hormonal IUD. If they said no, then they are using whatever method they select at 427. Based on that logic, I wrote the code below to try to calculate their method at this survey. I’m doing this to then pull this method into a follow-up survey to ask if they are still using this method from survey 1 at survey 2 6 months later.

Code:
if(${s1_301} = 1, ‘Hormonal IUD’,
if(${s1_301} = 0,
if(${s1_427} = 1, ‘Female sterilization (tubal ligation)’,
if(${s1_427} = 2, ‘Male sterilization (vasectomy)’,
if(${s1_427} = 3, ‘Copper IUD (IUCD)’,
if(${s1_427} = 4, ‘Hormonal IUD (LNG-IUD) diff than before’,
if(${s1_427} = 5, ‘IUD-unknown type’,
if(${s1_427} = 6, ‘Intramuscular injection (DMPA-IN, Depo, Net-EN)’,
if(${s1_427} = 7, ‘Subcutaneous injection by provider (DMPA-SC)’,
if(${s1_427} = 8, ‘Self-administered injection (DMPA-SC, Sayana Press)’,
if(${s1_427} = 9, ‘Injection - unknown type’,
if(${s1_427} = 10, ‘Implant (Jadelle, etc.)’,
if(${s1_427} = 11, ‘Pills (combined or progestin)’,
if(${s1_427} = 12, ‘Emergency Contraception’,
if(${s1_427} = 13, ‘Male condom’,
if(${s1_427} = 14, ‘Female condom’,
if(${s1_427} = 15, ‘Diaphragm/spermicide’,
if(${s1_427} = 16, ‘Lactational Amenorrhea method’,
if(${s1_427} = 17, ‘Standard day/calendar/rhythm/periodic abstinence/bead natural family planning’,
if(${s1_427} = 18, ‘Withdrawal’,
if(${s1_427} = 19, ‘Other’, ‘’))))))))))))))))))))),
if(${s1_301} = 99, ‘No response’, ‘’)))

I am getting an error code so please let me know if there is anything I can change!

@lilyduboff, why not use the dynamic data attachment feature if you plan to make a follow-up after 2-6 months? You could just use an identifier and list out all the responses that were entered in the round 1 survey.