Welcome to the third part of the “Create Your Own Fantasy Baseball Rankings” series. If you missed an earlier part, you can find it here. You can start at the beginning of the series or if you want to start here at Part 3, you can download the Excel file created during part 2 here.
Please note that this six part series has been adapted into a 10 part book that also shows you how to convert standings gain points into dollar values and how to calculate in-draft inflation.
A few notes about the series:
- It was originally written before the 2013 MLB season. The screenshots and player references you see might refer to things from that time frame, but the same approach will work today.
- If you register as SFBB Insider, you can receive all six parts in a free, tidy, and easy-to-use e-book
- Familiarity with Excel is recommended, but I do my best to explain all formulas and functions used
- Some of the formulas used in the series do not work in Excel for Mac computers. I apologize for this. I don’t understand why Excel isn’t built to operate the same on that platform.
In this third part of the series we will use Excel formulas and functions to start pulling player information (name, position, team) and projection information in order to eventually calculate our own rankings. Strap in… This is a long one.
Excel Functions and Formulas In This Post
Below are the Excel functions and formulas used in this part of the series. If you’re already familiar with what these are, you can skip ahead.
VLOOKUP
One of the most powerful Excel formulas, in my opinion. And it’s easier to use than you might think. This formula searches the first column of a table for a desired value (a player ID) and then returns a value that is in the same row but in a separate column. For example, we might tell Excel to go into a table of projection data, locate a specific player ID, and give us back the number in the eighth column (which holds the number of HRs).
This formula requires four inputs:
VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)
- lookup_value – This is the value to search for. In the rankings spreadsheet, we’re mostly going to use player IDs for this. “Hey Excel, go look for this player ID”.
- table_array – This has to be two or more columns of data. Excel will look for the look_up value in the first column in the set of data. You do not necessarily need to include the first column on a spreadsheet tab. But Excel is going to look through the first column you provide. “Hey Excel, here are ten columns of data for you, look through everything in the first column for the lookup_value.”
- col_index_num – This is the column number from the table_array that contains your desired information. This has to be a number and it has to be within the table_array you provided. For example, if your table_array only has five columns, but you put a 6 for col_index_num, you’ll have a problem. “Hey Excel, the eighth column has projected home runs. Tell me how many home runs are projected for this player ID.”
- range_lookup – This input can be either “TRUE” or “FALSE”. If you use “TRUE”, Excel will look for an approximate match of the lookup_value (PLAYERID). If you enter “FALSE”, Excel will only look for an exact match. This is an optional input, but I feel very strongly that it must be used and that “FALSE” is the option selected. You may otherwise get the wrong projections showing up for players.
TABLES (NAMED RANGES)
Excel has functionality that allows you to convert a block of data (player projections) into a table. There are quite a few benefits to using tables:
- Tables can have names. This is great for the table_array input in the VLOOKUP formula. We can give the projection sheet the name “STEAMER_H” (for Steamer Hitters projections) and use that instead of traditional way of selecting data in Excel (something like ‘Steamer Hitters’!A1:W500).
- Columns have names. I have a hard time remembering what column projected HRs are in. But I don’t need to if I know that the column name is “HR”. If you don’t use a table, you’re stuck trying to remember things like, “were HRs in column G, H, or I?”. When referring to a column, use the following convention – TABLENAME[COLUMNNAME]. The column name is surrounded in brackets.
- Easily adding calculations. In a table, all formulas within a column are identical. This is great for consistency. And because of this, when you change the formula in one cell of a column, the rest of the column automatically updates too. No more editing a formula in one cell and having to copy it to hundreds of other cells.
- Easy sorting and filtering. As easy as clicking a drop down arrow.
COlumn
This function returns the column number of a cell or range of data. The function only requires one input; the cell or range to be evaluated. For example:
COLUMN(TableName[ColumnName]) selects an entire column from a table and will return the column number.
STEP-BY-STEP INSTRUCTIONS
- In Part 1 of this series I showed you how easy it is to find some high quality projection data for free. For the sake of simplicity, I’m going to pick one source to move forward with. This smart article at Razzball reviews the accuracy of 2012 projections and puts the Steamer projections in a positive light. So I’m going to move forward and base my rankings off of Steamer. You can choose whatever source you prefer.
- To make the projections easier to work with, convert the “Steamer Hitters” tab to a “table” in Excel. Click anywhere within the data on your hitter projection worksheet. Then locate the “Home” tab in the Excel menu system (“the ribbon”). Click once on the “Format as Table” drop down, and then select your desired color scheme.You will then be prompted to verify the range of cells in the table and that your table has a header row (e.g. Name, AB, H, HR, etc.). Check “My table has headers”. Click OK.
After accepting this, your bland looking data will transform into a nicely formatted table. - We’ll later be pulling information from this table into other worksheets. To make the pulling of data easier we need to move the fangraphs player ID to be the first column (you can use VLOOKUP if the player ID is in the first column, otherwise you’re stuck using more difficult and/or multiple formulas). Right-click on the top of the fangraphs player ID column (I right clicked on the “AB” column header, not for At Bats, as in the column next to column “AA”) and Cut it.
- Now right-click on the top of the player name column (column header “A”) and select “Insert Cut Cells”.
- Before we finalize this table, we must give it a name. Go to the “Formulas” tab on the Excel ribbon and click on the “Name Manager” button.
- Excel will give very generic names to a table, like “Table2”. It’s more helpful to give meaningful names to your tables. As you get more tables in a spreadsheet, it can become very difficult to remember the difference between “Table2” and “Table3”. Note how there is already a table named “PLAYERIDMAP”. I previously set up this table before you inserted it into your Excel file in Part 2 of this series. Select your table from the list and click on the “Edit…” button.
- Give the table a meaningful name. I chose “STEAMER_H” to indicate these are the Steamer Hitter projections. Click “OK” to close the “Edit Name” menu. Then click “Close” to exit the “Name Manager”.
- We now have two tables ready to pull information from, PLAYERIDMAP and STEAMER_H. I’m going to pull from these two tables into a new tab where I’ll calculate the hitter rankings.
- Right click on the “PLAYERIDMAP” tab and select the option to “Insert…”. Choose the “Worksheet” option and click “OK”.
- Right click on the new sheet tab and choose to “Rename”. I’ll call this sheet “Hitter Ranks”.
- I want the first column of this new sheet to contain the Baseball Reference player ID (e.g. cabremi01). I believe the PLAYERIDMAP sheet has a list of all fantasy-relevant players (for standard rotisserie leagues, at least). However, this sheet contains pitchers also. Because this sheet is an Excel table, it’s easy to filter out those pitchers. Click on the drop down arrow on the “POS” column. You’ll be presented with a list of all the positions. Uncheck any “RP”, “SP”, “P” values (Note: at some point during 2014 I stopped classifying pitchers in these categories and now just track all as “P”). Click OK to apply.
- The Player ID Map will now list only hitters. Starting at the first player and ending with the last, click and drag within the “IDPLAYER” column (first column) and select all player (or select the first player and then use the keyboard shortcut SHIFT + CTRL + Down Arrow). Only select from this first column.
- Copy this selected data. Return to the “Hitter Ranks” sheet. Type “PLAYERID” into cell A1 (to label the column). Then paste the data into cell A2.
- Now that we’re starting this new sheet, we should convert it to an Excel table. We will essentially repeat step 2 above, but for this different worksheet. Click once to select any player ID. Then locate the “Home” tab in the Excel menu system (“the ribbon”). Click once on the “Format as Table” drop down, and then select your desired color scheme.
- You will then be prompted to verify the range of cells in the table and that your table has a header row (which we added in step 13). Check “My table has headers”. Click OK.
- Repeat steps 5-7 in order to give the table a more meaningful name. In my example, Excel defaulted the table name to “Table3”. I renamed mine to be “MYRANKS_H” (to indicate hitter ranks, because we’ll also be ranking pitchers).
- Now for the fun part… pulling data from the other tabs. I’ll first add “Player Last Name” to the table. To expand your table, simply type into column B and hit Enter (I typed into cell B1). Excel should automatically pull this new column into your table. I’m going to name my column “LNAME”.
- Our goal in this column is to instruct Excel to take the PLAYERID from column A, go into the first column of PLAYERIDMAP, find the matching PLAYERID, and then pull the corresponding LASTNAME. You can see in the image of the PLAYERIDMAP below that LASTNAME is in the fourth column (column D).To start building the formula, click in cell B2 of your Hitter Ranks tab. Then click the “fx” button of the formula bar to launch Excel’s formula wizard. We’ll use the wizard the first time through to better explain this function in Excel.
- Type “vlookup” into the search bar and click “Go”. When the function appears, make sure it is selected and hit “OK”.You should then see the different arguments, or components, needed for the formula to work.
- The “Lookup_value” is the value on the “Hitter Ranks” sheet that we want to locate in “PLAYERIDMAP”. Click once in the “Lookup_value” field. Then click on the value in cell A2 (“abreubo01”). Excel will convert this to [@PLAYERID]. This naming convention can be used when you have converted your date into an Excel table. If you can’t remember the naming convention, you can always use this formula wizard to build formulas.
- The “Table_array” field is the table in which to go look for the matching PLAYERID. Click once in the “Table_array” field. Simply type “PLAYERIDMAP” (no quotes). Again, this is another benefit of using Excel tables. It’s much easier to type in the table name than it is to flip tabs in Excel and select a giant range of data.
- The “Col_index_num” field wants to know the number of the column in the PLAYERID map table to retrieve data from. Again, our goal is to retrieve LASTNAME from the PLAYERIDMAP table, which is column 4. You could manually flip back and forth between tabs to determine the column number. You could then enter a 4 in for “Col_index_num”. This takes time and can be difficult if you start getting into column X (do you know what number letter of the alphabet that is?).Alternatively, I prefer to use the COLUMN function. When the COLUMN formula is entered into the Col_index_num field, it will return the column number. The formula below will determine that LASTNAME is the fourth column in the PLAYERIDMAP table.
COLUMN(PLAYERIDMAP[LASTNAME])
Enter this equation into the Col_index_num field.
- Finally, we have the Range_lookup argument. I always enter “FALSE” for this in order to ensure Excel only locates exact matches for a PLAYERID. I don’t want Excel to return an approximate match if the exact PLAYERID cannot be found.
- Before hitting “OK” to accept the formula, you can preview the output. In this case we are dealing with “abreubo01”, or Bobby Abreu, and can see the formula appears to be working. Click OK to accept the formula.
- Once the formula is entered, it should automatically copy to the remaining rows of the table.
- We will use the VLOOKUP formula to pull additional data, and the majority of the formula will remain the same. To add a FNAME column, type the column name into cell C1. Copy the formula from cell B2 (actually copy it from the formula editor bar, click ESC to exit the formula editor). Paste the formula into cell C2. Then simply change the column name (remember column names are surrounded in [brackets]. So change [LASTNAME] to [FIRSTNAME].
- Repeat step 26 to pull TEAM, POS, and IDFANGRAPHS from the PLAYERIDMAP tab. If you can’t remember the exact name of a column, once you have entered a table name, like PLAYERIDMAP, and the opening “[” bracket, a helpful type ahead box will display all the column names in the PLAYERIDMAP table.
- We’ve now pulled all the relevant information from PLAYERIDMAP and can now begin pulling in hitter projections. Add columns and VLOOKUP formulas to pull plate appearances (PA), at bats (AB), hits (H), home runs (HR), runs (R), runs batted in (RBI), walks (BB), strikeouts (SO), and stolen bases (SB).There will be some tweaks to the VLOOKUP formula we used earlier. First, the Steamer projections use Fangraphs ID numbers. So we will be using the IDFANGRAPHS column as the Lookup_value. Second, we must specify to pull from the Steamer Hitters projections (STEAMER_H table name). And finally, the COLUMN formula will change to determine what statistic to pull.
=VLOOKUP([@IDFANGRAPHS],STEAMER_H,COLUMN(STEAMER_H[PA]),FALSE)
- I don’t pull average or any other rate statistics (OBP, SLG, etc.). I prefer to recalculate them with a formula after the underlying statistics have been pulled. To do this, type “AVG” in as a column header. Then enter the formula to calculate batting average (H divided by AB).
- Most statistics don’t need formatting, but AVG will. Click on the “P” to select the entire AVG column.
Then on the Home tab of the ribbon, click on the comma number format.Finally, click on the symbol to increase the decimal places from 2 to 3.
- We’ve now successfully combined player information and projected stats into one table.
WRAP UP
This was a long one… Stick with it. In the next part of the series we’ll reperform many of these steps in order to create a pitchers ranks table. It will be a more abbreviated post that will only touch on the key differences needed for pitchers.
Please ask questions below. And as always, make smart choices.
Link To Download File: SFBB Rankings – Part 3.XLSX
IF YOU’VE MADE IT THIS FAR…
You might be interested to know that I’ve recently completed parts 7 through 10 of the “Create Your Own Rankings” series. These additional segments include the calculation of dollar values and incorporate calculations for keeper and in-draft inflation. All ten parts of the book are now available in Kindle format at Amazon. Please click here to read about these additions to the guide and how you can purchase all 10 parts. My hope is that this series is the best step-by-step guide to calculating SGP-based dollar values and inflation is available anywhere.
Please post your questions or suggestions to improve the rankings system in the comments here.
Excel keeps telling me that my formula is invalid at step 28… ideas on why it doesn’t want to pull my projections from steamer and associate it w the fangraphsID?
Spencer, if you copied Tanner’s formula and pasted it, then IDFANGRAPHS is misspelled as IDFRANGRAPHS. LOL. Just take out the “R.” It took me a bit to figure it out.
Thanks, Matt. I fixed this error.
I agree with Spencer. Even after accounting for the misspelling I still couldn’t get it to transfer the data from the steamer table. I feel like something else is amiss but am not sure as to what.
Spencer and Thomas, what version of Excel are you using? Are you using a Mac?
I’m using Excel 2013. I had no problem transferring data from the playerID sheet;however, transferring the data from the Steamer sheet proved to problematic. I spent about a half-hour troubleshooting it last night but couldn’t seem to the problem out. Every time I attempted the Vlookup command, it would give me #REF or #N/A in the cells.
*figure the problem out.
That’s what I get for staying up late messing with fantasy and then replying before I had my coffee.
Great site, looking forward to your reply.
I figured it out. I just needed to go through it again step by step. Doing it before midnight helped this time. Thanks for reaching out to me Tanner!
What did you do? I just went through it step by step and keep getting “your formula contains an error” messages.
Hey just wondering if you do some sort of average for the projection systems, maybe I missed something but aren’t the ranks only going to be based on Steamer?
By the way this is awesome and I’m having fun following along, thanks for doing this.
Hi, Jimmy. When I first set out to write this series, I did plan on including averaging of the projection systems. But it’s actually a complicated topic to explain, if I want to do it right. So at the time I elected to just show based on one system (Steamer). I do hope to have averaging instructions available one day. But I may not make it before the season. You could consider getting already averaged projections from FantasyPros.com or Cory Schwartz’s composite projections.
Or I could just make my own averages of all projection systems, but not sure if that’s useful. Do you know which system has the best correlation between projection/performance?
Thanks
You could make your own average of various systems. I believe it has been proven that averaging multiple systems typically gives better and more accurate results than using a single system. That is, unless a single system has proven to be more accurate and consistent over time. If you know the most accurate system, then you’re better off using that instead of averaging.
There are usually a number of articles around the web each year that evaluate the accuracy of various experts and projection systems. Here’s a table at FantasyPros (note Podhorzer is in the top 10, he explains his projection approach in Projecting X). Razzball usually puts out really interesting articles on the topic.
Steamer is highly regarded. It’s free. And easy to download. So I spotlight it a lot on the site.
I am also having a problem with step 28. I keep getting the response that invalid character, etc. I have tried going through the formula 3 times and nothing changes. I even tried renaming the file to Steamer. Still no good. Any help?
Hi Ron, I got your e-mail containing your spreadsheet. I think I see the steps you missed that are causing that formula not to work. I’ve e-mailed you a slightly corrected version that should work now. Let me know if you have other trouble.
Tanner, I am getting an error on step 21. When I type PLAYERIDMAP in the table_array it gives me this: #Name? Any ideas what I am doing wrong?
Hi Jason, that is Excel trying to tell you it does not recognize the “PLAYERIDMAP” name that should have come in when you copied the Player ID Map in during Part 2. Are you possibly using Excel on a Mac? Whether Mac or Windows, what version of Excel are you using?
I am using Windows with Excel 2010. I was using your examples and trying to alter them to my league parameters. I built one from scratch and everything works fine now..
Glad you got it figured out. You should have no issue with that version of Excel, that’s what I originally built the examples with. It’s possible the name of the PLAYERIDMAP could change if you tried to copy in a newer version on top of the existing one. You can check the names of the tables in the document by going to the “Formulas” tab and clicking the “Name Manager”. Perhaps it renamed it to “PLAYERIDMAP1” or something similar.
[…] performing the same search you did manually. This is another reason I am a big fan of using table names and structured references in Excel, especially when setting up lookup formulas. If you look at the formula below, you can […]