+ Reply to Thread
Results 1 to 18 of 18

Scalable baseball lineup from stats

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Scalable baseball lineup from stats

    I've searched here (and elsewhere) for something that will take baseball stat inputs and return an ordered list based on ordinal criteria (i.e. return max OBP unless also max OPS, then return 2nd best OBP). I found a website that will make a lineup, but does not have adjustable criteria and their criteria don't match mine. I did find one spreadsheet here, but I couldn't modify it (don't know enough Excel to do so), and it is not scalable.

    So, I am looking for a way to generate a lineup based on these stats: On Base % (OBP), Slugging (SLG), and OPS (OBP+SLG) and Batting Avg (BA)

    The rules I need to follow:
    #1 = best OBP unless is also best OPS or best SLG, then 2nd best OBP
    #2 = best OPS
    #3 = 2nd best OBP unless used for #1, then 3rd best
    #4 = best SLG unless same as #2, then 2nd best SLG

    Obviously, none can repeat, but would need to repeat the ordering for 20>n>7 players. Also, there will likely be duplicate numbers for each stat, so BA becomes the tiebreaker.

    I'd attach what I have, but I have nothing at this point, sorry. Any help would be appreciated! I hope I've been specific enough and I put this in the right place?

    Ray
    Last edited by AliGW; 08-03-2020 at 09:06 AM. Reason: Solved tag added - no need to edit thread title or add solved to post. Thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,892

    Re: Scalable baseball lineup from stats

    Welcome to the Forum lavudyar!

    I don't have a solution for you but I have some suggestions as to how to formulate your request to get a better response. First,
    Quote Originally Posted by lavudyar View Post
    I'd attach what I have, but I have nothing at this point, sorry.
    Even though you may not know how to solve any part of your problem, it would be helpful to provide a workbook with sample data, and manually set up the data to illustrate the result you are looking for. A "before & after" view would be ideal.

    The rules I need to follow:
    #1 = best OBP unless is also best OPS or best SLG, then 2nd best OBP
    #2 = best OPS
    #3 = 2nd best OBP unless used for #1, then 3rd best
    #4 = best SLG unless same as #2, then 2nd best SLG
    I am not quite sure how you want to use these rules. Do you mean that you want to use each rule to select the single player that meets that rule? That is, you'll end up with one player for #1, one player for #2, etc., and they will be four different players? When you referred to an ordered list it sounded like you wanted to sort a list of players, but that's not the same as four players. And four players is not a lineup. So that's why I'm a little unsure as to exactly what result you are trying to get.

    I've coached youth baseball so I'm familiar with your stats but I want to firm up where you want to go before spending any effort in the wrong direction.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    Quote Originally Posted by 6StringJazzer View Post
    I don't have a solution for you but I have some suggestions as to how to formulate your request to get a better response. First,

    Even though you may not know how to solve any part of your problem, it would be helpful to provide a workbook with sample data, and manually set up the data to illustrate the result you are looking for. A "before & after" view would be ideal.
    Not sure about before and after, but I have attached a wb that includes the stats I'd use and a sample lineup with the rules for each spot.

    Quote Originally Posted by 6StringJazzer View Post
    I am not quite sure how you want to use these rules. Do you mean that you want to use each rule to select the single player that meets that rule? That is, you'll end up with one player for #1, one player for #2, etc., and they will be four different players? When you referred to an ordered list it sounded like you wanted to sort a list of players, but that's not the same as four players. And four players is not a lineup. So that's why I'm a little unsure as to exactly what result you are trying to get.

    I've coached youth baseball so I'm familiar with your stats but I want to firm up where you want to go before spending any effort in the wrong direction.
    Yes, each rule to select a single player that meets the requirements, no duplicates obviously. I hope this makes sense?

    Thanks for your reply!

    Ray
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,892

    Re: Scalable baseball lineup from stats

    I have been looking at this and don't have a solution for you yet but my current thinking is that it is going to use VBA (macros). The logic is such that it will be easier for me to do it with VBA than formulas, although there are some real formula wizards around here that might be able to pull it off.

    Meantime, I am confused just a little about your ranking criteria. Are you taking an existing team, and then optimizing the batting order?

  5. #5
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    Quote Originally Posted by 6StringJazzer View Post
    Meantime, I am confused just a little about your ranking criteria. Are you taking an existing team, and then optimizing the batting order?
    That would be the plan, yes. I have a scoring app that I use in place of a paper scorebook, and it keeps batting and pitching stats. So I want to be able to bring the stats into Excel and have it set up the lineup per the Sabermetric rules I mentioned above.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,892

    Re: Scalable baseball lineup from stats

    OK, here's a solution. [All Star Lineup.xlsm] My results do not exactly match yours, but my initial analysis is that you may have made an error in following your specification. For example, the first mismatch is in slot #7, where you have Alena and I have Sammy. The criterion is best OPS that is not best SLG, but Alena has the best SLG of the remaining players so she doesn't qualify. I didn't follow up for the entire list.

    Naturally you must allow macros to run. Push the "Create Lineup" button to refresh the lineup.

  7. #7
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    That is one amazing bit of kit right there! Thanks a ton! Rep added!

  8. #8
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    HELP!

    The sheet worked GREAT last season! Now I'm trying to use for my new team, and I keep getting a Type Mismatch error after I paste the stats in. I can enter them by hand and it works. I'm sure it's just a formatting issue, but I don't know enough to figure out what I'm doing wrong.

    Ray
    Attached Files Attached Files
    Last edited by lavudyar; 05-29-2014 at 10:20 AM.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,892

    Re: SOLVED: Scalable baseball lineup from stats

    The error is caused by putting "---" into cells where a number is expected. Your scorekeeping app is putting in "---" for some stats when the player has no at-bats. Technically the stat is undefined if there are no at-bats but I suggest you put zeroes into those. That will cause you to underrate players like Syd with 3 walks and no hits, who has a perfect on-base percentage but will show a .000 batting average, but hopefully that will smooth out over the season.

  10. #10
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: SOLVED: Scalable baseball lineup from stats

    Man, I'm a dope. Didn't even look at that as a possibility. Thanks so much AGAIN!

    Ray

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,892

    Re: SOLVED: Scalable baseball lineup from stats

    Glad to help! Come back any time!

  12. #12
    Registered User
    Join Date
    04-15-2020
    Location
    Earth
    MS-Off Ver
    Office 365 for Mac
    Posts
    4
    Quote Originally Posted by lavudyar View Post
    Man, I'm a dope. Didn't even look at that as a possibility. Thanks so much AGAIN!

    Ray
    Has this been developed any further? Curious if you’d consider sharing it.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,698

    Re: Scalable baseball lineup from stats

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  14. #14
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    Quote Originally Posted by mrpeepers View Post
    Has this been developed any further? Curious if you’d consider sharing it.
    The only thing I did to modify the sheet was to add a tab for pasting my scorebook info, and then used vlookup to populate the master tab. The best part is that you can change the far right column to be whatever stat you like. I started with OPS and ended using wOBA (not true wOBA as I did not have access to the league averages; I used MLB modifiers). The same 2014 sheet above is still valid as is.

  15. #15
    Registered User
    Join Date
    04-15-2020
    Location
    Earth
    MS-Off Ver
    Office 365 for Mac
    Posts
    4

    Re: Scalable baseball lineup from stats

    Awesome! I LOVE it, thanks for sharing.

    Hey mod, I think our definitions of "hijacking" are a bit different. This thread was dated, so, I think it's a legitimate question to ask the OP if he'd developed his/her solution since the 6 years that have passed since the OP.

  16. #16
    Registered User
    Join Date
    07-17-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    42

    Re: Scalable baseball lineup from stats

    Quote Originally Posted by mrpeepers View Post
    Awesome! I LOVE it, thanks for sharing.
    Do not change the title of the OPS column though! The VBA looks for that specifically and you will break the sheet. I haven't dug into that, probably an easy fix but it doesn't matter because it sorts based on that column no matter what numbers end up in it.

  17. #17
    Registered User
    Join Date
    04-15-2020
    Location
    Earth
    MS-Off Ver
    Office 365 for Mac
    Posts
    4

    Re: Scalable baseball lineup from stats

    Got it, and thanks. No need, I just edited the data — that's it (imported from Game Changer) and it works like a dream

  18. #18
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Scalable baseball lineup from stats

    I am happy you got what you wanted. However, both you and lavudyar are in contravention of the Mod instruction in post #13. Please do not ingore mod instructions in future.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Organize Baseball Stats from Multiple Sources
    By par0016 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2013, 11:15 AM
  2. Trying to access tables and stats from Baseball Reference
    By arsenal123gunners in forum Excel General
    Replies: 1
    Last Post: 06-24-2010, 11:27 AM
  3. Baseball stats?
    By Nissi in forum Excel General
    Replies: 2
    Last Post: 05-13-2010, 10:37 AM
  4. Analyzing Baseball Stats
    By madmanmac in forum Excel General
    Replies: 1
    Last Post: 10-26-2006, 03:15 PM
  5. Baseball Stats question: How can I get the RBI's?
    By AVERAGE(user) in forum Excel General
    Replies: 7
    Last Post: 10-25-2005, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1