Cognito-forms – Calculation Total

cognito-forms

I have a form with Yes or No questions and would like to assign a value to each of the answers, example: yes=-1/No=1. Then I would like to have a total calculation from all of the yes or no answers at the bottom of the form. This is what it looks like in excel. I already have the form typed up in Cognito with each of the yes and no sections. All I need is a way to do the calculation.

enter image description here

Best Answer

I'm a developer for Cognito Forms.

Yes, you can set this up using a Calculation field set to the type of 'Number'.

You will need to set up an 'If Then' option for each of your questions to assign a '1' if "Yes" is selected otherwise a '-1' will be assigned. I have set up several questions as an example.

if DoYouLiveOutsideOfMarshallCounty = "Yes" then 1 else -1
if DoYouHaveAnySourcesOfIncome = "Yes" then 1 else -1
if DoYouHaveAnyOtherPeopleLivingInYourHome = "Yes" then 1 else -1

You will then need to contain each 'If Then' option inside of parentheses ( ) so that you can add them together, into a grand total.

=(if DoYouLiveOutsideOfMarshallCounty = "Yes" then 1 else -1) + (if DoYouHaveAnySourcesOfIncome = "Yes" then 1 else -1) + (if DoYouHaveAnyOtherPeopleLivingInYourHome = "Yes" then 1 else -1)

I have included a link to my demo template, that you can copy into your Organization. This will let you see both the build page, and the preview page to see Calculation in action.