[Back]  [Print Page]
Validating number questions
Keywords: x

Description: Describes how to verify that user-submitted numbers equal 100.

You can validate numerical input from respondents using a Validation Message question type. This is helpful when you want to enforce a sum total for numerical values such as enforcing that percentage values add up to 100.

For more information, see Validation Message Question.

  1. First, add a question where users will input numbers such as a Matrix Number Boxes question (Matrix Number Boxes Question):
    validate number questions
    To validate that the numbers entered in Input 1 and Input 2 add up to 100, you will need to add a Validation message after this Matrix Number Boxes question.
  2. After building your Matrix question, right-click the last row (Input 2 question) on the Edit tab, and click Insert After.
  3. Click Validation Message from the Question Gallery.
  4. In the Validation Message editor, enter the message that will appear if the sum total of question 1 is not 100 - such as The sum total in the last question does not add up to 100. Please go back and correct your answer.
  5. Click Ask if. The Ask if page displays.
    ask if confidential
  6. On the Ask if page, choose Other from the drop-down menu, and click OK. The Ask if Conditional page displays.

    On the Ask if Conditional page you will enter a formula to validate that the numbers entered in Input 1 and Input 2 of question 1 add up to 100. The formula will state that if Input 1 and Input 2 do not equal 100 a validation message should display.

    The formula will need to reference Input 1 and Input 2 from question 1. You can reference question fields using Vista syntax as described in Using Piping and Advanced Ask if Logic. In our example, you will reference Input 1 with [Q1a] and Input 2 with [Q1b] and enforce the "do not equal" rule with the operator !=. The formula to validate question 1 is: [Q1a]+[Q1b]!=100.

    ask if conditional
  7. Enter the formula [Q1a]+[Q1b]!=100 in the Ask if Conditional page text area, and click OK.
  8. On the Validation Message page, the formula is displayed next to the Ask if button.
    validation message with formula
  9. Click OK to return to the Edit tab.
  10. To test the formula, click Test Logic from the left-hand menu.
  11. In question 1, enter numbers that do not add up to 100: 
    total sum question
  12. Click Next.

    The validation message displays and the user must click the Back button to return to question 1.

    validation error


See also:
How do I make questions conditional?