Thursday, April 19, 2012

How to do Google Docs Polls - Part 1

Anyone can ask questions in Google Docs and collect answers. But if you want to use it for polling you are going to have to go beyond the simple answers on the web and do a little trickery to avoid ballot box stuffing.

Background

I was asked in a Scouting Google+ Hangout the other night if there was a way to run simple polls with Google Docs and, of course, the answer is yes. However if just put up a form and collect submissions then you are subject to ballot box stuffing. You also lose track of the ability for your respondents to change their mind.

Part 1 - Creating the Files

In this post I am going to take you through a typical Scouting situation and show you how to build a poll that will collect votes on what movie we are going to watch. This poll is going to allow anonymous voting and it will also allow voters to change their mind.

Designing the Poll Form

For most simple polls all you need to do is add a multiple choice box with your choices, however if you are going to prevent voter fraud you are going to need one additional field. We will call this field voter ID. For later purposes we are going to make sure Voter ID is the first question.


Charting Our Results 

Once we have our poll form we are going to do some trickery to get a result. One element of that trickery involves us only counting votes from valid Voter IDs.

Back in our spreadsheet we are going to add a new sheet. In column A1 of that sheet we use the sort function to reorder the form data. For example =sort('Raw Data'!A:C;1;FALSE) where "Raw Data" is the name of my form data sheet and A:C are the columns of form data.

Now the magic part. We add a third sheet, in this sheet we will add our voter IDs to column A and then use a VLOOKUP function on the descending sorted sheet to find their last vote. We will also keep track of uncast votes.

=IF(ISERROR(VLOOKUP(A2;'Descending Sort'!B:C;2;FALSE));
"Undecided";
VLOOKUP(A2;'Descending Sort'!B:C;2;FALSE))

Our last sheet does a simple COUNTIF across all of the votes to compute the result. We can then chart the results and put it on our web page.

Resources:
The Spreadsheet File


At this point you are probably starting to wonder about those Voter IDs. I have a whole column dedicated to them and it's currently empty. In Part 2 we will discuss Voter IDs, voter fraud and ballot box stuffing.

No comments:

Post a Comment