Archive for category Visual Basic

Excel Macro for NFL Data

Thought I posted this but obviously I haven’t.

Web developers and programming veterans often consider visual basic and excel to be amateur. But I find it to be extremely powerful, and those that are inclined to deviate from what is used by the consensus for spite deprive themselves of one of the more considerably tractable programs available.

Here is the excel macro VB code to get NFL data from Statfox.

What you need to do before running is create a table with the names of each team according to the parameters that correspond to the web address, i.e. San Diego = San+Diego, Giants = NY+Giants

You can speed up the process by importing a team report or statistics table from the website and find all ‘” “‘ and replace with ‘+’ (Find spaces and replace with +), go here and copy and paste or the more efficient way is to import through excel web service browser

NFL Preseason – Team Report

Then select all the teams in the table and define a name to the range, a brief survey of the code and one can see I named the range “NFLTeams”

That’s it, run the code. Takes a while but gets the job done. The workbook will contain however many years worth of sheets for each team, all named with the same format, team and year (Arizona2009, Washington2004, NY+Jets2007, etc…)

All impertinent and superfluous data will be stripped, and if you scan the code you can probably figure out which command is used to strip the data.

Each sheet will have the date, opponent, score, line, total, ats results, total results, offense/defense – rushing yds, rypa, passing yards, pypc

A great way to learn VB is to record a macro and see the result, and use google

, , , , , , , , ,

No Comments

MVP and Cy Young Odds Evaluation Process

I decided to take a look at the MVP and Cy Young  odds.  So in doing so, I felt it appropriate to utilize the excel macro framework uncovered in my college football and subsequently line movement survey posts.  Both required some form of data extraction process, using different sites but implementing similar programming methodology.

The imminent site for baseball awards and statistics is, as one knows, baseball-reference.

I haven’t analyzed the numbers yet, but thought it beneficial to share the extraction code for those inclined to undergo some form of related odds evaluation process.

Here is the excel workbook with 2000-2009 data already in place with sheets labeled according to the date.  Ten years of data seems optimal enough for me.  From my standpoint, further experiments in finding fair-value odds on these MVP and Cy Young futures would require including the future odds themselves.

MVP+CyYoung

At length I’ll post the results.

, , , , , , , , , , , , , , , , , , , , , , , ,

No Comments