I 💙 Spreadsheets, Election Night Precinct Data Edition

I am finally, after sixteen years of post-college experience as a “software engineer” learning to understand and love spreadsheets. So much so that I’ll inefficiently figure out how to do something in a spreadsheet to answer a question as opposed to just writing a script or dropping the data into a proper structured data store with a more programmer focused query language. But spreadsheet formulas, etc. are programming! I am fairly certain that some business spreadsheets I’ve seen are self-aware and planning to throttle us all. Anyway, I can do this. I am a professional.

Tonight I dumped the August 1st primary election night precinct level results CSV file into a Google Spreadsheet and decided to do some programming. You can find the original csv on the elections website – look on the “Download results” tab to see what’s available. The specific file I played with is this one. Note that all the screenshots on this post are using the election night results only. The final precinct results won’t be available until August 16th, sob, though at that point I can just replace one tab in my spreadsheet and voilà! It will all update.

Some questions I wanted to answer:

  • How different does the mayor’s race look like in different legislative districts?
  • What parts of the city supported which position 8 candidate?
  • What’s turnout by precinct?

Now I have answers! First some screenshots.

Turnout is quite variable. Sadly I’m not a very good PCO yet:

Spreadsheet screenshot: precinct turnout

Unsurprising to me, Nikkita Oliver did as well as Durkan in the 37th LD. You would know this just by walking around the last few weeks.

Spreadsheet screenshot - Mayor's race, 37th LD

And Bob Hasegawa of course did quite well in his own LD:

Shows screenshot of results for the mayor's race in precincts in the 11th LD.

Also, totally unsurprisingly, Durkan is strong up in the NW of town:

Shows screenshot of results for the mayor's race in precincts in the 36th LD.

In the Position 8 race, there’s of course variability. The 37th LD:

Screenshot of spreadsheet for the 37th LD's vote on position 8

But in the 36th (northwest part of town), Sara Nelson did a lot better:


Okay, to the spreadsheet! You can download a copy here. The recalculations can be slow, so be patient. You probably will have to copy it to change anything and show results for a different LD/precinct because that link is read-only.

The calculations are probably slow because I don’t know what I’m doing! I only started learning how to do things with spreadsheets beyond the most basic of things very recently (I told you I’m a professional programmer!) Fun things I learned tonight:

  • FILTER is pretty great but extremely finicky and I don’t understand it’s error messages yet. I started using it with expression “multiplication” (AND logic) this week on an actual work project and played with it more here. I suspect that is 90% of the reason why these calculations are hella slow. But it’s a lot more flexible that VLOOKUP and HLOOKUP which is what I used to do some complicated stuff on another spreadsheet but it was so indirect and tedious. FILTER is a hammer by comparison.
  • ISNA. That is a real function name in spreadsheets. It means “is the #N/A error”. This is very useful because in spreadsheets you produce #N/A all the flipping time. Also #N/A doesn’t really work well in boolean logic very well without calling ISNA first.
  • This is not a new thing, but I have to call it out anyway: being able to reference data in other sheets is just tops. I seriously didn’t know how to do that till a few weeks ago. Also anchors where you use $ in front of a column or row reference (e.g. “$B$5”) so that when you copy and paste a formula everything doesn’t shift all over the place when you don’t want it to.

Anyway, if you haven’t figured it out I am kind of weirdly and strangely in love with spreadsheets right now. I spent like two hours tonight playing around with this data even though I could have written “regular” code (probably ruby) to do it in probably 20 minutes.

But! When the final results come out I can just replace that first full results sheet with the final data and everything will magically re-calculate! It’ll be great.