# Survey123 Formula

419
2
Jump to solution
06-16-2021 07:24 AM
New Contributor III

I am trying to populate a comment box with a specific comment based off the answer from a multiple choice question. There are three total choices for the multiple choice, Compliant, Non-Compliant, No Comment. The formula I have come up with is below.

 (if(selected(\${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(\${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment'), if(selected(\${VSMPSWPPP_SWPPP_MS1}'N/A'), 'SWPPP Not Inspected'))))
1 Solution

Accepted Solutions
MVP Honored Contributor

You have a ( at the beginging and a ) and , in the wrong spots.  Also you need the else part on the last if.  I just gave it '' for now (this would be the case where nothing at all is selected).

if(selected(\${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(\${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment', if(selected(\${VSMPSWPPP_SWPPP_MS1}, 'N/A'), 'SWPPP Not Inspected', '')))

Try that.

2 Replies
MVP Honored Contributor

You have a ( at the beginging and a ) and , in the wrong spots.  Also you need the else part on the last if.  I just gave it '' for now (this would be the case where nothing at all is selected).

if(selected(\${VSMPSWPPP_SWPPP_MS1},'Compliant'), 'In Compliance',if(selected(\${VSMPSWPPP_SWPPP_MS1},'Non-Compliant'), 'Non-Compliant Comment', if(selected(\${VSMPSWPPP_SWPPP_MS1}, 'N/A'), 'SWPPP Not Inspected', '')))

Try that.

New Contributor III

Perfect. Thanks for your prompt response.