Loading...
  • Customer Experience
    Customer Experience
  • Employee Experience
    Employee Experience
  • Brand Experience
    Brand Experience
  • Product Experience
    Product Experience
  • Core XM
    Core XM

Using Logic

What's on This Page:


Was this helpful?


The feedback you submit here is used only to help improve this page.

That’s great! Thank you for your feedback!

Thank you for your feedback!


About “Using Logic”

“Logic” refers to the condition a respondent must meet in order to see a question, receive an email, or trigger some other behavior in a Qualtrics survey. Each of the following features in the Qualtrics uses logic in some way:

  • Branch Logic for showing a block of questions conditionally.
  • Display Logic for showing a single question conditionally.
  • Quotas for determining which respondents should count toward a response limit you set.
  • Custom Validation for requiring respondents to meet certain answer requirements before proceeding in a survey.
  • Email Triggers for conditionally sending an email upon survey completion.
  • Contact List Triggers for conditionally adding a respondent to a contact list upon survey completion.
Example: You may want to show a question only to those who are above the age of 18. Use display logic to set a condition based on age, and hide the question from respondents who don’t meet the condition.
Example: You may need to send an email to every respondent who scores above an 80% on your exam. Use the conditions on an email trigger to set this condition based on scoring Embedded Data, and send the email only to those who meet the condition.
Qtip: The logic used in your Actions and in filters for Reports, Results, and Data & Analysis is different than the logic described on this page, and instead utilizes an “Any” vs “All” approach. Please see the linked pages for guidance.

Creating Conditions

Whenever you are presented with a logic window in Qualtrics (such Display Logic or Branch Logic), you will see a series of dropdown menus. These menus determine the condition parameters. Each menu specifies the logic condition further until you have a full statement.

Display logic that says the question will only appear if the respondent has indicated they are a Freshman

In the example above, we are trying to hide a question about student mentors from anyone who isn’t a freshman. If we read this screenshot word for word, it says,

Example: Display this Question only if the following condition is met: in response to Question 12, “What is your year in school?” Freshman is Selected.

Basically, a respondent has to confirm that they’re a freshman before we ask them who their student mentor is.

Creating a Basic Condition

It’s best to think of your condition as a statement. Think of the condition you want the respondent to meet, and build a statement that describes that condition.

Let’s start with an example. We want students to rate their dorms. However, we don’t want to ask this question if the student says they don’t live in student housing.

Qtip: Based on the type of field you choose in Step 1, the following steps may vary. The purpose of these instructions is to get you started with a general example.

Display logic: How do you like your dorm? Display this question only if the following condition is met: question Q11 do you live in dorm housing? No is not selected

  1. Decide what your logic will be based on. Is it the answer to a question? Embedded Data set in the survey flow? Contact list information? In our example (and in most instances), this dropdown should say Question.
  2. Select the field (or question) the logic should be based on. Here, we choose, Do you live in student housing?
  3. These dropdowns finish the sentence. Here, it says No Is Not Selected. We could have also put Yes Is Selected. Basically, this is a person who has confirmed they live in student housing.

Adding Multiple Conditions

Sometimes the logic you want to create requires more complex conditions. Conditions can be connected with an AND conjunction or with an OR conjunction.

When conditions are linked by AND, that means both conditions must be met. If conditions are linked by OR, that means either condition can be met. Note that as you add more logic,  conditions linked by AND are evaluated first, followed by conditions linked by OR.

Example: This question will display if the respondent is a freshman AND the respondent lives in student housing. If the respondent is a freshman but does not live in student housing, they will not see this question, and vice versa.

Display logic that the question will only appear if the respondent indicates they are a freshman and that they live in student housing

how to add a new condition

  1. Click the plus sign ( + ) to the right of an existing condition.
    Plus sign to the far-right of a condition
  2. Select whether your new statement should be an And statement or an Or statement.
    The word And combines two conditions, but can be replaced with Or
Qtip: When you press the plus sign ( + ) to create a new condition, this creates a duplicate of your previous condition. This makes building similar conditions easier, so you only have to change a few fields at a time instead of selecting them all from scratch.
Adding another condition has resulting in the same condition repeated

Troubleshooting multiple conditions

Depending on your needs, conditions may get longer and more complex than the examples we’ve tried out so far.

What respondents do you think will meet the following quota? Remember the order of operations: conditions linked by AND are evaluated first, followed by conditions linked by OR.

The logic says, If the marital status is never married, and the gender is female, or the age is greater than 18, and the marital status is widowed, or the marital status is married

These are the three very different segments of respondents that would fulfill this quota:

  1. Never Married and Female (regardless of age), OR
  2. Over 18 years old and Widowed (regardless of gender), OR
  3. Married (regardless of age or gender)

When you add this many conditions to your logic, you should probably use new logic sets to separate everything out more clearly. Read the next section to learn more.

Creating Advanced Conditions with Logic Sets

As your logic becomes more advanced and includes more conditions, you may need to start using logic sets. A logic set is a group of conditions that are evaluated together. Similar to statements, logic sets can be linked with an AND conjunction or with an OR conjunction.

Logic sets allow you to say that if one whole group of statements is true AND/OR if another whole group of statements is true, then the condition is met.

Display logic that says respondents can only be 18-24 year olds from the US or 25-34 year olds from Canada

In this example, the question will only be displayed if the respondent is either:

  • 18–24 years old AND from the US
  • OR 25–34 years old AND from Canada.

The question will not be displayed if the respondent is 18-24 from Canada, or 25-34 from the US. It also won’t be displayed to 18-24 year olds from any other country, and so on.

how to add a new logic set

  1. Click the plus sign ( + ).
    Showing the plus sign to the right, the AND dropdown to the left, the final option in the AND dropdown which says to move to a new logic set
  2. In front of your new statement, open the And dropdown.
  3. Select Move to a new Logic Set.
  4. Set the condition(s) for your new logic set.
    An AND / OR dropdown appears between the logic sets, in bold
  5. Determine if your logic sets are joined by And or by Or.
Qtip: You can also press Shift on your keyboard while clicking the plus sign ( + ) to add a new logic set.

Types of Logic

Now that you understand how to build logic in Qualtrics, we can dive into the specific types of logic available. Let’s start by going into what’s available for each part of the platform that uses logic, and proceed into how each one works.

Logic can be based off of how a respondent answers a question, information we saved ahead of time in a contact list, whether or not a quota has been met, and more. However, based on where you’re using logic in the platform, not all of these options will make sense. The table below illustrates the types of logic you can use in each part of Qualtrics.

Logic Based on… Branch Logic Display Logic Quotas Custom Validation Email Triggers Contact List Triggers
Questions Yes Yes Yes Yes Yes Yes
Embedded Data Yes Yes Yes No Yes Yes
Contact Lists No Yes No No No No
Quotas Yes Yes Yes No Yes Yes
GeoIP Location Yes Yes No No No No
Loop & Merge No Yes No No No No
Device Type Yes Yes No No No No

Logic Based on a Question

You can set logic based on answers respondents give to questions. Depending on the type of question, you’ll encounter different logic options. There are two main types of logic options you’ll see: choice selection and text entry.

Choice selection questions are any questions where the respondent selects from a range of predetermined options (e.g., Multiple Choice, Matrix, Slider). Open-ended questions are any questions where the respondent inputs a free-form answer (Text Entry, Constant Sum, Rank Order).

Qtip: When basing logic on a question, make certain that question appears to the respondent before they encounter the logic.

setting logic based on choice selection questions

  1. Choose Question from the first dropdown.
    First dropdown in a display logic set is choosing what kind of variable - here, a Question
  2. Choose the specific question from the second dropdown.
    The second field dropdown reveals a list of questions
  3. Choose the specific answer choice from the third dropdown.
    Third field allows you to select a choice from the question
  4. Choose how the respondent should interact with the choice from the fourth dropdown.
    Final fields allows you to choose what about the choice. Here, the choice of Yes is Selected, and that's what triggers the display logic
  5. Click Save.
    Save at bottom-right of display logic window
    A question with this logic will only display to respondents who indicate they use Qualtrics.

setting logic based on open ended questions

  1. Choose Question from the first dropdown.
    Question selected in first field
  2. Choose the specific question.
    Specific text entry question selected in second field
  3. If your text entry is a form, then choose the specific field. If your text entry question isn’t a form, you may not have this step.
    Third dropdown allows you to select from which field in the Text Entry form you want (first name, email, etc)
  4. Enter a value to use for your logic. Select Ignore Case if you don’t want capitalization to affect the logic.
    In this display logic, question 1 email field is equal to a domain of choice
  5. Decide how the value the respondent enters should compare to the value you specified.
    Fourth field dropdown has options such as equal to, greater than, etc.
  6. Click Save.
    Save on lower-right
    A question with this logic will only display to respondents who have “@qualtrics.com” as part of their email address.

Possible Fields for Question Logic

You’ll notice that there are many ways to format logic based on a question. This section runs through the different fields, what they mean, and how you fill them out.

In a logic statement, the final dropdown, where you determine if the choice you entered is selected, displayed, not selected, etc.

Standard

These options tend to show up on all question types.

  • Is / Is Not Displayed: Base logic on the choices displayed to the respondent. See our page on adding display logic to answer choices for more information on hiding and displaying choices to respondents.

Multiple Choice

Any question with a Multiple Choice option can have logic based on these fields. This not only includes Multiple Choice, but Side by Sides, Matrix Tables, and so on.

  • Is / Is Not Selected: Base logic on specific choices the respondent did or did not select.
  • Selected Count: This option only appears for Multiple Choice questions set to Multiple Answer. This option will allow you to base logic on how many answers someone selected for a multiple choice question, rather than the exact answers they selected.
  • Choice (Text Entry): This field is only an option when you allow text entry on a choice. (For example, adding an “Other” option with a fill-in-the-blank next to it.) Selecting this field allows you to base logic on the text that has been entered in this choice.
    Display logic that says a question will be displayed just so long as the text entry question previous isn't empty

Text Entry and Numeric Questions

Any open-ended or numeric question has these options. This includes Text Entry questions, Other Text, Text Entry Matrix Tables, Sliders, Constant Sums, and so on.

  • Is / Is Not Equal To: Base logic on an exact number the answer is or is not equal to. For Text Entry, this can be used as an exact match, requiring the response to contain an exact phrase or word.
  • Is Greater / Less Than / Equal To: Base logic on answers greater than, less than, or equal to a specific number.
  • Is / Is Not Empty: Base logic on whether or not the respondent left the question blank.
  • Contains / Does Not Contain: Base logic on whether certain content is in the response. Selecting Ignore Case means the question will ignore capitalization.
    Example: You may not care exactly what a user says in a Text Entry question about their pet, but will send them to a set of questions about dogs if “dog” is contained in the response.
    the text entry question must contain the word dog to display this next question
  • Matches Regex: Base logic on regex code. Regex code can be useful for restricting exact characters, words, and more.
    Qtip: Because Regex is custom coding, Qualtrics Support cannot help you create your regex. They can only help you figure out where it goes once it’s done. You can always try asking our community of dedicated users instead.

Matrix Tables

These fields apply to Matrix Tables and Side by Sides.

  • Scale Point: Choose whether a specific Scale Point has been selected or displayed.
    Example: Display a question so long as “Strongly Agree” has been selected for any of the statements in your matrix table.
    Strongly Agree is entered in the second to last dropdown of the logic
  • Statement – Scale Point: Choose whether a specific Scale Point has been selected for a specific Statement.
    Example: You might say to display a question only if someone rated the statement “Your experience with customer support” as “Extremely satisfied.”
    Your experience with customer support - extremely satisfied is selected
  • Scale Point (Count): Base logic on the number of times a scale point has been selected.
    Example: “Extremely Satisfied” needs to be selected at least 5 times for someone to go down a special path for satisfied customers in the survey.
    Survey Flow. Branch says if extremely satisfied count is great than or equal to 5, the respondent goes to the Extremely Satisfied Customer Questions block
  • Statement (Recode): Instead of choosing a specific scale point for a statement, you can instead use the recoded numeric values of your scale to set a range.
    Example: Maybe your Matrix has 7 scale points, and the last 3 are positive. You might only display a branch about high satisfaction if the Recode is Equal to 5 or Greater.
    Your experience (recode) is greater than or equal to 5

Questions in Looped Blocks

When you apply Loop & Merge to a block, the questions in that looped block get additional fields, in addition to the Standard and Multiple Choice ones:

  • Select a Loop by Name: A specific choice is selected in a specific loop.
  • Current Loop: A specific choice must be selected on the current loop.
    Example: You are asking people to review events they attended. The block loops for every event they say they attended. In Q25 they are asked, “Did you enjoy your time?” And then, if they say “Yes,” Text Entry question Q26, “Please elaborate,” appears.
    Display logic on a question in a looped block Maybe the respondent enjoyed the first event they will review, but not the second. In that case, you need to use “Current Loop” display logic to ensure only selecting “Yes” on the current loop makes the next question appear.
    Current Loop is selected
  • Any Loop: A specific choice was selected on any loop.
    Example: You’re running a survey about several events you hosted. In a looped block, you ask respondents if they got sick off the food. It doesn’t matter if the respondent only got sick at 1 out of 100 events – you want to know what they ate that made them sick. In a later block, you put in a follow-up question that shows up if they said they got sick in Any Loop.
  • All Loops: A specific choice must be selected on all loops.

Logic Based on Embedded Data

Embedded Data fields connect additional information to each response, such as an ID number or a supervisor name.

Qtip: When basing logic on Embedded Data, make certain that the Embedded Data is set in the Survey Flow before the respondent encounters the logic.

setting logic based on Embedded Data

  1. Choose Embedded Data from the first dropdown.
    Basing logic on Embedded Data
  2. In the next field, click the dropdown arrow to see a list of the Embedded Data saved in your Survey Flow.
  3. Click the name of the Embedded Data field you would like to use in your logic.
  4. Select an Embedded Data value from the dropdown, or type in a value. Make sure to get spelling and capitalization exactly the same as it appears in your Survey Flow or Contact List.
    Embedded Data logic
  5. Choose how the respondent’s Embedded Data value should compare to the value you specified.
    Qtip: If you’re going to type an exact value (for example, a Professor’s name, or a valid zip code), you should use Is Equal To or Contains.
  6. Click Save.
Example: In the logic we set up in the screenshots, only people taking a class with Professor Harmon will see the question.

Using Piped Text with Embedded Data Logic

Have you ever wanted to ensure two Embedded Data fields don’t equal the same value? Or make sure that the answer provided in a question matches the one provided in an Embedded Data field? You can do all of this and more with Piped Text!

Piped Text allows you to take the value from any Embedded Data, question, quota, score, and so on that the respondent has data for. Since the final field in Embedded Data logic is blank, you can paste Piped Text here.

If you are using display logic, there will be a dropdown arrow to select the Piped Text. If you are using Branch Logic, you will have to create the Piped Text in a survey question or Embedded Data Element, cut it, and paste it into the field.

Example:  You want to send respondents to a special block if the professor you have saved for them in your contact list doesn’t match the professor they say they have. When setting up the branch logic, you pipe the Selected Choices for the question of what professor they have in the last field of the branch logic. See the following image.

Then branch if Embedded Data Professor is not equal to piped text for selected choices from question

Logic Based on a Contact List

If you’re planning to distribute your survey using a contact list, information from that list (such as name and email address) can be used in logic conditions.

setting logic based on a contact list

  1. Choose Contact List.
    Contact list selected
  2. Choose the desired contact list field (e.g., First Name or Email).
    First Name field selected
  3. Enter the value to be used for your logic.
    Email is selected and set equal to qualtrics.com
  4. Choose how the respondent’s contact list value should compare to the value you specified.
    Equal to being changed to contains
  5. Click Save.
    save button on lower-right
    A question with this logic will only display to those respondents with a qualtrics.com email address.

Possible Fields for Contact List Logic

To learn more about each contact field, see the linked support page.

  • First Name: Base logic on the contact’s first name.
  • Last Name: Base logic on the contact’s last name.
  • Email: Base logic on the contact’s email address.
  • External Data: Base logic on the contact’s External Data Reference.
Qtip: Additional fields you may have added to your contact list are not under Contact List. Instead, they are under Embedded Data.

Logic Based on a Quota

Quotas allow you to keep track of how many respondents in certain groups have completed your survey. Logic conditions can be based on whether or not a specific Quota has been met, as well as what the value of the Quota currently is.

setting logic based on a Quota

  1. Choose Quota from the first dropdown.
    Quota is selected
  2. Choose which quota you want to base your logic on.
    The specific quota is selected
  3. Choose whether to act if the quota Has been met or Has not been met or choose to enter a numeric value.
    Choose whether the quota is met or the count is a certain amount
  4. Click Save.
    Save button on bottom-right
    A question with this logic will display until the Qualtrics Users quota has been met.

Possible Fields for Quota Logic

  • Has Not / Been Met: Base logic on whether a quota has been met or not.
  • Is / Is Not Equal To: A quota’s “count” is the number of respondents who have taken the survey and met the conditions of the quota. You can base logic on an exact count the quota is or is not equal to.
  • Is Greater / Less Than / Equal To: Base logic on what the number of people who have met the quota are greater than, less than, or equal to.

Logic Based on GeoIP Location

Attention: As of September 22nd 2020, the State/Region GeoIP codes for regions outside the US/Canada will be changing from FIPS 10-4 codes to ISO 3166-2 codes. US States and Canadian Provinces will be unaffected, but other regions may be different after the change.

Qualtrics can use the respondent’s IP address to estimate their location. This information can be used in your survey logic. This type of logic can only be applied to branch and display logic.

Qtip: GeoIP Location data is not 100% accurate. It is an estimation of the respondent’s location based on their IP address. Any respondent who is hiding their IP address, using a remote access tool, or using more general addresses will provide less accurate GeoIP estimations.

setting logic based on GeoIP Location

  1. Choose GeoIP Location from the first dropdown.
    GeoIP location logic
  2. Choose the location category.
    select location category
  3. Enter the location identifier value to be used for your logic.
    Final field filled with a zip code
  4. Choose how the respondent’s location identifier value should compare to the value you specified.
    Choosing whether the field is what the question should be equal to or another function
  5. Click Save.
    Save button
    A question with this logic will only be shown to respondents in the 84601 postal code.

Possible Fields for GeoIP Location Logic

GeoIP Location allows you to choose a location category and then define it.

Location Category

Select a location category / second dropdown expanded to show list

  • Postal Code
  • City
  • State/Region (Make sure to use State Codes, e.g., WA, not Washington.)
  • Country Name
  • Country Code
  • Location From Map

Defining Fields

You define the first five location type by using Text Entry-style fields.

  • Is / Is Not Equal To: Base logic on an exact location name or value.
  • Is Greater / Less Than / Equal To: Base location on numbers greater than, less than, or equal to a specific number.
  • Contains / Does Not Contain: The location contains certain letters/words/phrases.
  • Matches Regex: Base logic on regex code. All regex code must be contained inside forward slashes ( / ). For example, /regex/.
    Qtip: Because Regex is custom coding, Qualtrics Support cannot help you create your regex. They can only help you figure out where it goes once it’s done.

Location from Map

Location From Map allows you to select locations from a provided map.

  1. Click Select Locations.
    Select Locations button
  2. Select an island or continent.
    clicking north america on the map
  3. Select a country.
    selecting the USA from a north american map
  4. Select cities, states, or regions. Note that not every city will be available.
    selecting cities and states before hitting Save
  5. Click Save when you’re done.

If you selected the wrong country or continent, you can click Back to world view.

If you selected lots of locations you no longer want to select, you can get rid of them all by clicking Clear.

Logic Based on Loop & Merge

Within a block that has Loop & Merge applied, you can apply logic based on what loop the respondent is currently in. This kind of logic can only be applied as display logic.

loop and merge logic

  • Not / Current Loop: Choose a specific loop and whether it is the current loop or not.
    Example: Maybe there is one question in your block that only makes sense if it applies to Brand Experience. In that case, you only display the question if Brand Experience is the current loop.
    current loop display logic

Logic Based on Device Type

You can base conditions on the type of mobile device that is or is not being used. This includes Mobile (any mobile device), Blackberry, Android, iPhone, iPod, Opera Mobile, Palm, Windows Mobile, and Other Mobile (any mobile device that is not listed here).

Example: In our survey, we have special questions for people who are accessing the survey on mobile, and special questions for people who are accessing the survey on desktop. For mobile users, the logic says to show the mobile questions if Device Type Is Mobile. For desktop users, the logic says to show the desktop questions if Device Type Is Not Mobile.

Screenshot of exact logic described in survey flow branches

Logic Based on True – False

For both Display Logic and Branch Logic, you can create a logic condition that is either always true or always false. This can be especially helpful when you’re still building your survey, as you can test the different paths your survey takers could follow without you needing to build complex logic conditions. Additionally, using the false condition is particularly useful for hiding questions in an active survey since this allows you to create a condition that always evaluates to false.

Setting Logic Based on True – False

  1. Choose True – False from the first dropdown menu.
    a logic statement set up using true/false logic. the statement is set to "true" meaning the question will always display
  2. Select whether you want the condition to always evaluate as True or False.
  3. Click Save.

If you select True, then the question will always be displayed to respondents. If you select False, then the question will never be displayed to respondents.

FAQs