+ Reply to Thread
Results 1 to 3 of 3

Fantasy Premier League (FPL) - Swapping players for subs depending on minutes played

  1. #1
    Registered User
    Join Date
    11-30-2010
    Location
    My House, England
    MS-Off Ver
    2010 & 2019
    Posts
    2

    Question Fantasy Premier League (FPL) - Swapping players for subs depending on minutes played

    I've been a member 12 years but never needed to post until now as I find most answers are already in the forum but this one has me stumped!

    As the FPL phone app is useless at times and doesn't even work properly when you look at the head to head teams I knocked up my own FPL spreadsheet. It looks at the API to get live data and gets the 16 players league score info for the teams. It includes who has the bonus points at that moment in time as again the FPL take ages to update after the game. It works well enough and gives you up to date scores rather than waiting the hour plus for the app to update to add any bonus points. This is a basic version of what it looks like and I just auto upload the table online so I can view it on my phone at any time if I'm not at home.

    H2H FIXTURES.jpg

    The only problem I have now is the swapping of players if subs are required as 1 or more of the 11 initially selected players haven't played any minutes. Again this takes an age for the FPL to update after the game has finished but it's possible to look at the player status at any moment in time and make subs depending on that status, even during live games. The goalkeepers are easy to do as it's just a one on one direct check to see if they needs changing but other 10 selected outfield players are a bit more complicated due to the formation requirements and limits.

    This is an example of a team with 15 squad players with various bits of info that I think is enough to work out the team of 11 players to be counted and the are what the columns show.

    A - 15 squad players
    B - Player name
    C - Team they play for (irrelevant)
    D - Position they play
    E - Fixture (irrelevant)
    F - Whether the game has been played or not (I don't think this is relevant as minutes played by player will determine if they can be in the FINAL 11)
    G - How many minutes the player has played
    H - How many points the player has
    I - Player status to either be in FINAL 11 or on BENCH

    INITIAL SQUAD.png

    Every squad has the following number of players in a position.
    2 Goalkeepers
    5 Defenders
    5 Midfielders
    3 Forwards

    The 11 players who are in the final team has to have the minimum of the following.
    1 Goalkeeper
    3 Defenders
    3 Midfielders
    1 Forward

    So ignoring the goalkeepers, all the formations allowed for Defenders, Midfielders, Forwards are as follows.
    3, 4, 3
    3, 5, 2
    4, 3, 3
    4, 4, 2
    4, 5, 1
    5, 3, 2
    5, 4, 1

    In the example table of players above it uses the formation is 3, 5, 2 and that all have played at least 1 minute in their game so it says PLAYED in column F. The only subs allowed are ones that would change the formation to any of the above. Subs who have played minutes are brought in if any of the squad players from #2 to #11 who have not yet played a minute. One thing to note is that if a sub is a FORWARD and there is a FORWARD who has played 0 minutes then the straight swap would be made first to keep the same formation. There are 3 of these in the example and the subs need to be looked at in order of #12 first then #13 then #14 and then #15. The subs don't have to match the position if the new formation created is a valid one so for example a forward could come in for a midfielder in the team above.

    In the team above, squad players 1, 4, 5 & 8 haven't played so they need substituting if it's possible. That's only if there is a valid sub to be swapped with them or else they just stay in the FINAL 11. The first sub to be looked is the goalkeeper but that's easily done using a simple formula as there's only 2 goalkeepers to compare so that's SUB 1 done. The first oufield player who didn't play is #4 which is DEFENDER 3. The SUB 2 required for #4 defender has to look at first available sub which is #13 FORWARD 3. However that would mean a formation of 2,5,3 which isn't a valid formation. That means #13 is to be skipped for SUB 2 but may be valid for SUB 3 & 4 checks. The next available sub is #14 DEFENDER 4 so it's a like for like position so this is a valid sub so it is to be made. The formation is still the left as 3,5,2 for SUB 3 checks.

    The next player to be subbed #5 MIDFIELDER 1 so needs to look at the first sub available which is #13 FORWARD 3 again. This sub would allowed as the new formation would be 3,4,3.

    The final player to be subbed #8 MIDFIELDER 4 and the last sub available is #15 DEFENDER 5. This is allowed as the new formation would be 4,3,3. That means the final team would look like this below as all 4 subs have been used. The SUBS column I would simply say FINAL 11 or BENCH without any reordering of players as there's no real need for it to be reordered. The total team points are simply added up only if the player is in the FINAL 11 and they're highlighted in light red in both tables.

    FINAL SQUAD.png

    There are probably many permutations of subs depending on how many are required due to whether players have any minutes or not. Ignoring goalkeepers, there could be more than 3 outfield players who don't play any minutes. Those 3 are replaced using valid subs with formation limits and the others players who don't play any minutes would stay in the final team of 11 players. This can happen for example if some games for the players #2 to #11 have not yet played but players #13 to #15 have played. Players #13 to #15 would be subbed in temporarily to show the potential team but if one of #2 to #11 play then it may mean players #13 to #15 are then put back on the bench. I can work it all out in my head yet it sounds complicated to explain. I think it's an easy process if you consider the player state at that moment in time such has their match played yet, have they played any minutes etc, what position are they etc.

    Again, ignoring the goalkeepers, there could be another way to look at the outfield players. Starting with SUB 2 and checking if there's a space for them. SUB 2 is a FORWARD so it first has to look at a direct swap but the 2 FORWARDs in the team have both played minutes. If one FORWARD had 0 minutes then it would be a straight swap but there isn't so now it needs checking to see if the FORWARD can replace a DEFENDER or MIDFIELDER. It would look for the first player in the list on 0 minutes and then check if they can be replaced and keep it a valid formation. In this example it would be DEFENDER 3 it would find first but that would mean a formation of 2, 5, 3 so it isn't valid. It would then find MIDFIELDER 1 next and this is a valid sub and the new formation would be 3, 4, 3. The next sub would be for SUB 3 which is a DEFENDER and this would be a straight swap for DEFENDER 3 keeping the formation 3, 4, 3. The final sub would be for SUB 4 which is a DEFENDER and it would find MIDFIELDER 4 and make the final formation 4, 3, 3.

    Reading all my waffle again before posting make it look complicated but I don't think it is when you work it out manually, it's just I can't think how to do it in Excel. I hope I've explained this enough without confusing people too much and I would prefer any suggestions that could use formulas in cells and extra columns aren't a problem and the reason I posted this thread in this forum. I got so far doing it but using multiple columns but it got messy! I'm not really that experienced in VBA though I have used it to manually change code I've found to suits my needs many times in the past.
    Attached Files Attached Files

  2. #2
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,313

    Re: Fantasy Premier League (FPL) - Swapping players for subs depending on minutes played

    Administrative Note:

    As a member for twelve years, you should be familiar with our scross-posting rule.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    (Note: this requirement is not optional. As this is your first post, I shall do it for you THIS TIME: https://www.mrexcel.com/board/thread...layed.1220498/)
    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.

  3. #3
    Registered User
    Join Date
    11-30-2010
    Location
    My House, England
    MS-Off Ver
    2010 & 2019
    Posts
    2

    Re: Fantasy Premier League (FPL) - Swapping players for subs depending on minutes played

    Apologies as I've never posted before and only browsed very occasionally over the years as I normally find answers to my problem without needing to post.

+ 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. [SOLVED] Looking to auto generate players per round in a game being played.
    By peejaygee in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-27-2020, 03:05 PM
  2. [SOLVED] premier league football predictor - unable to calculate draws / include form
    By Gimmers in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-28-2019, 10:17 AM
  3. Counting How Many Players Played a Game with Percentages
    By saulgodman in forum Excel General
    Replies: 9
    Last Post: 07-27-2018, 11:51 AM
  4. [SOLVED] Calculate minutes played by players in sport
    By tlacloche in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2013, 09:38 AM
  5. Replies: 9
    Last Post: 01-02-2012, 04:08 AM
  6. Favourite English Premier League Teams
    By inayat in forum The Water Cooler
    Replies: 20
    Last Post: 09-20-2011, 04:28 AM
  7. Premier League Stats
    By gbWildy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2007, 02:18 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