The Excel Web Query and Predicting the Washington State Governor's Race

Web Queries in Excel let you grab tabular data off of a web page without writing any code or messing with web services. I use this feature all the time as a manager trying to grab internal business data off of many different systems in order to analyze it. In this example, I build a computer model of the political race. The entire project can be done in less than 20 minutes.

  1. Open Excel 2003

  2. Choose Data | Import External Data | New Web Query...

  3. Browse to https://vote.wa.gov/general/status.aspx and select the table that lists ballots left to be counted by county. 

  4. After the table is imported do it again for the results in the race found so far found at https://vote.wa.gov/general/resultsbycounty.aspx?o=3001&t=s

  5. You should now have both tables side-by-side in Excel. You can color and format them however you like:

  6. Create further columns to find the percentage a candidate gets from each county and then multiply that percentage against the remaining ballots in that county.

  7. Finally, total the projected votes with the votes a candidate already has and you will arrive at a projected final outcome.

  8. Now here is the really cool part: whenever new totals are posted on the web sites you can update your spreadsheet with Data | Refresh Data. Excel keeps your nice formatting and fomulas and just gives you the new numbers.

A final solution can be downloaded here.