Skip to main content
Loading...
Skip to article
  • Qualtrics Platform
    Qualtrics Platform
  • Customer Journey Optimizer
    Customer Journey Optimizer
  • XM Discover
    XM Discover
  • Qualtrics Social Connect
    Qualtrics Social Connect

Formula Variable Creation


Was this helpful?


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

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 Formula Variable Creation

Formulas are a type of custom variable that allow you to create formulas with your survey’s data. Values assigned with a formula variable are applied to both collected and future data, making formula variables an alternative to embedded data in situations where you need variables to be added retroactively. Once created, formula variables can be used in the Data and Weighting sections of the Data & Analysis tab and in the Results section of the Reports tab. They can also be exported with your dataset or be retrieved by API if you use Create Response Export, Get Response Export Progress, and Get Response Export File calls.

For information on making changes to an existing formula, see Editing Custom Variables.

Example: You ask your respondents for their height and weight to calculate their BMIs (Body Mass Indexes). After data collection, you realize you forgot to add a math operation for BMI to your embedded data. Creating a formula variable allows you to calculate this variable on collected data retroactively.

Creating a Formula

  1. Go to the Data & Analysis tab.
    Field Editor button in top-right corner of Data & Analysis tab
  2. Select Field Editor.
  3. Select Create Field.
    create field button within field editor
  4. Select Formula at the top.
    New Variable Name text box, Equation text box, and variable selectors
  5. Name your formula variable.
  6. Type your equation in the box. The green checkmark to the left of the box will become a red warning sign if your equation doesn’t make sense.
    Qtip: Every formula starts with x and y, but you can add new variables by typing new letters into the box, and remove variables by deleting the corresponding letter from the formula box.
  7. Set x and y equal to a question, survey metadata, or embedded data.
  8. When finished, click Create Variable.
  9. Click Review and Publish to save your changes.
    review and publish button
  10. Click Publish your Changes.
    publish your changes button

    Qtip: Click Data Table to return to your data table.
Qtip: Formulas aren’t calculated until after a response is submitted. If you want to display calculations to your respondents in the middle of a survey, use Math Operations.

Using the Correct Syntax

A formula has to make sense before it can be added to your data. A red warning sign will appear when creating your variable if the formula doesn’t make sense.

  • Always remember to close parentheses. ( x + y ) will work, but x + y ) won’t.
  • Numbers, single-letter variables, and the symbols listed in the table below are compatible with formulas. However, combined letters, like xy, are not. Instead, use x * y.
  • Spacing has no impact on the effectiveness of a formula. x/(y^2) and x / ( y ^ 2 ) will work the same way.

Available Operations

Math Operation Symbol Example
Addition + x + y
Subtraction x – y
Multiplication * x * y
Division / x / y
Powers (x^2) ^ x ^ y
Absolute Values abs( ) abs(x)
Ceiling ceil( ) ceil(x)
Floor floor( ) floor(x)
Qtip: If you don’t want to type them in, you can access Absolute Value, Ceiling, and Floor from the function (fx) icon, as seen below.
Operator selector for absolute value, ceiling, or floor

Compatible Variables

Not all variables can be used in a formula. Compatible items must finite in nature, or be set to accept numeric values using recode values to determine the numeric value assigned to each answer choice. This includes:

  • Any question with a multiple-choice option
  • Questions set to numeric-only answers, such as sliders and constant sum questions
  • Text entry questions set to numeric validation
  • Embedded data set as number or number set types
  • Survey metadata for response type, progress, duration (in seconds), and finished status
Qtip: Looking to combine non-numeric variables? Check out our Bucketing Variable Creation and Manual Variable Creation features.
Qtip: Formula variables aren’t compatible with scoring or scoring categories.

Projects Where Formula Variables Can Be Created

Data & Analysis is available in many different types of projects. The options described on this page are available in:

Qtip: When custom fields are added to a CX Dashboard, they become derived data. Although supported, they behave a little differently than other survey fields do. See Derived Data for more details.

While the functionality is technically available, we do not recommend using these custom fields with other types of Employee Experience projects. See Creating New Fields (EX) for more details.

Qtip: While other areas of the platform (like dashboards, Stats iQ, and directories), may also allow you to create new fields, this page is solely focused on how to create new custom fields in Data & Analysis. For steps on creating other kinds of fields across the XM platform, try narrowing your support site search.

FAQs