Sometimes when creating surveys in Qualtrics you wish to do some kind of math on a respondent’s answer. This post outlines a simple way to do so using javascript.
The procedure involves three main components. First, there are the questions themselves. These are the responses you wish to do some math operations on. Second, there are embedded data variables. You create these variables in the survey flow, and they allow you to save the values you calculate for later use. For example, you could use them in the survey flow (branch logic) or display the values as piped text. Third, there is the javascript. The javascript reads the answers of the questions, performs the math, and saves the embedded data variables.