Calculating the number of days between two dates is easy as this worksheet shows.

The example we will use is of a vacation questionnaire where we want to find the period of time the respondent has spent on vacation. In addition, there is a requirement to determine the average length of stay by age of respondent and to group the period away into useful bands.

The original questionnaire asked for the date when respondents went on vacation, the date they returned and the age of the respondent.

### Step 1

Enter two open ended, date response questions, one for vacation departure date and one for the vacation return date. Then create Q3 using a multiple-choice, single response question to capture respondent’s ages. You can do this easily by using the reference window . Now ensure that the data has been input into Snap.

### Step 2

From the Variables window click on New Variable to create the variable that will contain the formula to work out the number of days between the two dates.

### Step 3

Enter the following information:

 Name: DaysAway Label: Days Away on Vacation Type: Derived Response: Quantity Text: Days Away on Vacation

In the Values column, in the same row as Valid, type Q2-Q1. This will calculate the amount of days between holiday departure date and holiday return date.

### Creating a table to show the average length of stay by age

This is one way that you could display the results of the data.

### Step 1

Click on Results Table .

### Step 2

Change the Calculate field from Counts and Percents to Means and Significances.

### Step 3

Type the Q3 into Analysis and DaysAway into the box to the right of Means & Significances.

### Step 4

Click OK to show results.

### Grouping the number of days on vacation into useful bands.

This will categorise the data so that a table or chart can be produced.

### Step 1

From the Variables window  click New Variable  to create the variable to show the amount of days from the departure date to the return date.

### Step 2

Enter the following information:

 Name: Length Label: Length of Vacation Type: Numeric Response: Single

### Step 3

Click in the Label field for Code 1 and type out the first answer e.g. 1 to 3 days. Press Tab on the keyboard, this will jump to the Values column. In this column Snap needs to know what numbers are to be displayed in this answer e.g. 1 to 3. Follow the same procedure to create categories for 4 to 6 days, 7 to 10 days and over 10 days.

### Step 4

Click on Toggle Details  and change Source to DaysAway.

### Step 5

Click Keep changes  to save.

### Step 6

Click on Results Table  or Results Chart  to show the results definition window.

### Step 7

Type the word Length into Analysis. Click OK to show results.

If there is a topic you would like a worksheet on, email to snapideas@snapsurveys.com