This topic is 4381 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

Hey guys,

I have several fields that I am trying to combine into one field that would provide multiple answers based on the choices of the other fields. For example say I have 3 fields with radio buttons.

First field is "How many times have you voted" choices are "None, 1, 2, 3 or more".

Second field "What party do you affiliate yourself with?" choices are "Republican or Democrat"

Third field "Have you ever worked for the government" choices are "yes or no"

Now I have a calculation field that I want to return one answer for all of these questions.. (i.e. if "1, Republican and no" were chosen then it would show "Voted once, as republican, never worked for government" or if "none" was selected then it would return "never voted" etc...)

This is what I have so far but I am getting a "0" as the return:

If ( HowManyTimesVoted = "None"; "Never voted"; " ") or if (HowManyTimesVoted = "1" & PolicticalParty ="Republican" & WorkedForGovt = "No";"Voted once, as republican, never worked for government"; " ")

Thanks

##### Share on other sites

Hey guys,

I have several fields that I am trying to combine into one field that would provide multiple answers based on the choices of the other fields. For example say I have 3 fields with radio buttons.

First field is "How many times have you voted" choices are "None, 1, 2, 3 or more".

Second field "What party do you affiliate yourself with?" choices are "Republican or Democrat"

Third field "Have you ever worked for the government" choices are "yes or no"

Now I have a calculation field that I want to return one answer for all of these questions.. (i.e. if "1, Republican and no" were chosen then it would show "Voted once, as republican, never worked for government" or if "none" was selected then it would return "never voted" etc...)

This is what I have so far but I am getting a "0" as the return:

If ( HowManyTimesVoted = "None"; "Never voted"; " ") or if (HowManyTimesVoted = "1" & PolicticalParty ="Republican" & WorkedForGovt = "No";"Voted once, as republican, never worked for government"; " ")

Thanks

Make sure your calculation is set to return text and not number.

##### Share on other sites

I suggest you use the Case() function for this. Also, you need to use the logical operator and instead of the text concatenation operator &.

##### Share on other sites

This could be simplified if you don't require the response to be completely prosaic and grammatically perfect.

```Case (

HowManyTimesVoted = "None";

"Never voted" ;

"Voted " & HowManyTimesVoted & " times, as " & PolicticalParty & ", " & Case ( WorkedForGovt = "No" ; "never worked for government" ; "worked for government" )

)

```

You can make the function return fancier (more prosaic) results but you'll get to the stage where you'll be special-casing practically every permutation of answers. You are better off forming the question and answer in a way that it makes sense when summarised in a simple calculation.

Quite aside, as an Australian the concept of people not voting is strange because voting here is compulsory. (Technically people don't have to vote but they do have to attend a polling booth: they can choose to lodge an "informal" vote if they wish which does not count.) The compulsory vote places responsibility on both the voter and the Government itself: it is required by law to get the vote from every single Australian citizen including those overseas, in remote locations (and down here we have some seriously remote locations) and those in prison serving a sentence of 3 years or less. This prevents the government from disenfranchising groups of people from their democratic rights. ;)

##### Share on other sites

This worked perfectly, thank you.

This could be simplified if you don't require the response to be completely prosaic and grammatically perfect.

```Case (

HowManyTimesVoted = "None";

"Never voted" ;

"Voted " & HowManyTimesVoted & " times, as " & PolicticalParty & ", " & Case ( WorkedForGovt = "No" ; "never worked for government" ; "worked for government" )

)

```

You can make the function return fancier (more prosaic) results but you'll get to the stage where you'll be special-casing practically every permutation of answers. You are better off forming the question and answer in a way that it makes sense when summarised in a simple calculation.

Quite aside, as an Australian the concept of people not voting is strange because voting here is compulsory. (Technically people don't have to vote but they do have to attend a polling booth: they can choose to lodge an "informal" vote if they wish which does not count.) The compulsory vote places responsibility on both the voter and the Government itself: it is required by law to get the vote from every single Australian citizen including those overseas, in remote locations (and down here we have some seriously remote locations) and those in prison serving a sentence of 3 years or less. This prevents the government from disenfranchising groups of people from their democratic rights.

##### Share on other sites

This topic is 4381 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account