# Finding Christmas tree entries in survey data

#### kualjo

##### Board Regular
Does anyone have any experience with formulas or macros that can help determine individual survey response sets that might be invalid because the respondent christmas-treed the survey. I can find straight-lined responses, but christmas-trees are trickier. Because of the nature of the survey, this actually shouldn't be a problem, but I want to be sure that I have the cleanest data possible.

The survey is 75 questions with 6 response items each (Strongly disagree to Strongly agree). There are reverse-scored items, so an average sample set would tend to spread equally around the midpoint.

### Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

#### mjbeam

##### Well-known Member
What would you consider a Christmas tree response to the survey. In other words, what pattern exactly are you trying to detect?

#### mjbeam

##### Well-known Member
I played around with some data and found a possible way to detect systematic vs random sequences in the surveys. If you do a discrete cosine transform on the data and look at the range of the frequency data you can spot systematic variance in the data. Here is a UDF that will return the range of the frequency space after the transform:

Code:
``````Public Function DCT_Range() As Double

Dim dct(75), tMax, tMin As Double

tMin = 256
tMax = -256
For i = 1 To 74
t = 0
For x = 0 To 74
t = t + Cells(x + 2, 2) * Cos((Application.WorksheetFunction.Pi() * _
(2 * x + 1) * i) / (2 * 75))
Next
t = (2 / 75) ^ 0.5 * t
If tMax < t Then tMax = t
If tMin > t Then tMin = t
Next i

DCT_Range = tMax - tMin

End Function``````

This UDF assumes 76 rows of data (headers in row 1, values in rows 2-76), question number in column A and answer (1-6) in column B. I populated column B with random data and the UDF returned a range of about 5. I then entered repeating data such as (1,6,1,6,1,6,1,6...) and (1,2,3,4,5,6,5,4,3,2,1,2,3...) and (1,2,3,4,5,6,1,2,3,4,5,6,1,2,3...) and the UDF returned ranges from 9 to 13.

Replies
3
Views
793

1,191,177
Messages
5,985,140
Members
439,942
Latest member
bkexcel11230

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back