How to: Logic Editor


Within a survey, you may wish to ask questions that are only relevant to particular people. Perhaps based on their experiences, age, or position within an organisation. Question logic provides a simple way to introduce conditional questions to your survey, only showing questions to relevant groups or audiences based on their answers to other questions.

If you are looking for help to exit respondents early based on logic, please take a look at our Exit logic guide.

Using the logic editor

Conditional questions can be added to your survey using the survey editor.

By their nature, conditional questions are dependent on an answer given previously in the survey (or imported as a prefill for invite surveys); for example a conditional question such as 'how often do you use your older person's bus pass?' would first require an answer from a question such as 'are you eligible for an older person's bus pass?'. The answer to the eligibility question can then determine whether the frequency of use question is shown or hidden.

For this reason you must first create the question upon which the logic depends, designed with those you wish to see the question in mind. It is advisable to make this question required, which will ensure the question is answered in order to drive your logic. Once you have created this question, your conditional question(s) can be placed in any section that follows.

Please note: a conditional question cannot be used within the same section as the question upon which the logic depends. The two questions must be separated by a section header or page break. Since the question could appear or disappear based on a given answer the user experience would suffer, especially for screen reader users, if this change happened on the same browser page.

Steps to add logic to a question

Whilst you are editing a question you can click the [Logic] button and this will allow you to hide or display the question depending on the answer to any previous question

In this simple example, there are a series of questions in an 'About You' section. It includes a question asking which location the respondent is based in. A question in the following section is targeted at those based in the 'London' location.

Logic survey

  1. To apply logic to the targeted question, click on the question tile and click the [Logic] button. This will open the Logic Editor within the question.
    Logic button
    Logic editor 1
  2. The Logic Editor provides you with a number of fields to set – the question which the logic relies upon, the condition which must apply, the answer value the condition applies to and the appearance behaviour. First, we’ll link an earlier question upon which our logic should be based using the dropdown. In this example I have picked the location question.
    Logic editor 2
  3. Next we want to specify the condition which should apply. Depending on the question type that the logic is based upon, you will be presented with different options. For example, numerical questions offer ‘greater than’ or ‘less than’, multi-select questions also offer ‘includes’ and most other questions only offer ‘equal to’ or ‘not equal to’. For this example, we will set this to “equal to”.
    Logic editor 3
  4. Next, we will specify the answer upon which to base the logic. The answer choices are provided to you in a dropdown, pulled from the question you have based the logic upon. Select the answer upon which you want to base your logic. For our example, we will set this to “London”.
    Logic editor 5
  5. Then we need to specify the appearance behaviour this logic will have – do we want to show or hide this question? For our example, we will set this to “show” since we want to display this question to respondents based in the London site.
    Logic editor 6
  6. Now that our logic is set up, we must check the displayed/hidden settings on our logic dependent question. You may have noticed that the Logic Editor shows a red warning box prompting us to check the displayed/hidden toggle. The question is currently set to 'displayed', and the logic is set up to 'show' the question if the criteria are met. In this instance, there is no situation in which the question will be 'hidden'. Since we want to hide the question from all respondents except for those based in London, the best approach will be to set this question to 'hidden', with our logic then displaying the question to those who answer London to the location question. Now that the question’s displayed/hidden toggle and the appearance behavour setting in the Logic Editor are different, the logic will now change the visibility of the question and the red warning box has disappeared.
    Logic editor 7
    Logic editor 7a
  7. You will see a banner on questions which have logic applied to them, or where they are reffered to by logic. This banner will summarise the logic present. The eye icon with a slash through it also tells us that the question is set to 'hidden' and we can quickly review the logic in the banner to see it will ‘show’ the question when the logic condition is met, confirming the question and logic are set appropriately in this situation.
    Logic overview survey editor
  8. Additional lines of logic can be applied to the same question for more complex set-ups (see advanced heading for more information). Using the buttons in the Logic Editor, additional rows of logic can be added, copied (for fast editing) or deleted.

Once you have finished adding logic to your survey, it is always advisable to test through your survey to ensure it behaves as you would expect. For more information on testing your survey, please refer to the 'How To - Testing your Survey' document.

Using logic on section headings

The same principles described above can be applied to section headings as well. In this case, entire sections will be displayed/hidden based on the logic set. This allows us to apply similar logic to a section heading, targeting a series of questions to a desired group or audience. The questions within the section will not require logic as they will be hidden/displayed by the section logic, thereby making this a quick way to apply logic to groups of questions.

Logic section headings

Advanced use

  • You can 'stack' the logic i.e. apply more than one piece of logic to each question. In this instance the last piece of logic will 'win' if there are conflicting conditions. This is particularly useful when applying logic to a multi-select question when you would like the logic to act on a particular choice even though several choices may have been selected.
  • Having a question displayed and then hidden by logic vs. having a question hidden then shown by logic is a matter of personal preference. However you may find the simplest approach changes depending on the situation. When layering multiple pieces of logic for example, you may find it easier to show a hidden question. Conversly, when only showing a question to a small number of people, you may find it easier to hide a displayed question.
  • Multi-select questions have the 'includes' logic condition available. This can be used to make some otherwise complex logic set-ups achieveable using just one or two lines of logic.
  • There are several types of logic condition available to use, the available conditions are dependant on the question type used.
  • When using the "not equal to" condition, consider whether the question upon which logic is based is optional or could be hidden by logic itself. Both of these set-ups could lead to a blank response to the question which will not be equal to your selected answer.
  • You can also have multiple logic questions dependent on the answer to one question. For example if you create a multiple choice question, you can set up a logic question to display for each different choice.
  • The advanced settings of your survey allows you to show unstarted or completed sections in the respondent interface. This can be a useful feature to help users skip back in the survey or be able to see what is coming up. In the case of using logic on sections however, it is wise to hide unstarted sections as it may affect which sections are shown to your respondents.
  • The advanced settings of your survey allows you to show a progress bar, although think carefully about this if you have used conditional logic as hidden questions can impact the behaviour of the progress bar. For this reason, we generally recommend you turn off the progress bar when logic is used.
Last updated: February 19, 2024
Errors, omissions, or comments? Let us know!