Forum Discussion

JWesty's avatar
JWesty
Copper Contributor
Jan 06, 2024

Create a ranking

In a sports ladder (just a list of players, not a league, nor tournament) a player (the challenger) can challenge another (the opponent) who is up to three places above them. If they win, they move above that player. Which could be one, two or three places above depending on the pre match positions.
The outcome will be either win/loss -no draw.

I suspect that a points based solution will not work, but rather a solution that moves names above others in a ranking, based on outcome. 

 

Any help here would be super appreciated... 

 

How do I add an attachment here?

 

Thanks James

  • JWesty 

    You may still be reeling so I have had a first cut at incorporating your data

    Dragging the corner of the matches table down should incorporated additional matches as would adding further data.  The stats columns could be added as required.

  • JWesty 

    This is a 365 implementation that relies upon Lambda functions.

    It uses REDUCE to update the ladder for each game result in turn.

    "Worksheet formula"
    = REDUCE(ladder, SEQUENCE(ROWS(GameTbl)), Updateλ)
    
    "Updateλ(current, idx)"
    = LET(
        challenger, INDEX(GameTbl, idx, 2),
        challenged, INDEX(GameTbl, idx, 3),
        outcome,    INDEX(GameTbl, idx, 4),
        aspired,    IF(current = challenged, challenger, NA()),
        removed,    IF(current <> challenger, current, NA()),
        reordered,  TOCOL(HSTACK(aspired, removed), 3),
        IF(outcome, reordered, current)
      )

    I hope the attached demonstrates the calculation works despite looking nothing like a 'proper' spreadsheet!

    • JWesty's avatar
      JWesty
      Copper Contributor

      PeterBartholomew1 

       

      Many thanks Peter. The outcome is what I'm after.

      The formulae from NikolinoDE helped me to get the other columns set up, so this is good progress!

       
      I'm not an advanced user, and so have to apologise now for the next question - how do I adjust it for my spreadsheet that I shared images of, and where do I place the code?
      I can't even see on your spreadsheet where the formula is, or where it's pointing to. 
      I've tried to understand it and it's a level above my knowledge or guestimatability 😞
       
      p.s. You attached the spreadsheet - is it possible for me to do that? (I'm new to this forum).
       
       
       

       

      • PeterBartholomew1's avatar
        PeterBartholomew1
        Silver Contributor

        JWesty 

        You may still be reeling so I have had a first cut at incorporating your data

        Dragging the corner of the matches table down should incorporated additional matches as would adding further data.  The stats columns could be added as required.

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    JWesty 

    Creating a dynamic ranking system based on match outcomes without a points-based approach is certainly possible in Excel. You can use a combination of Excel formulas and sorting to achieve this. Here is a step-by-step guide:

    Set Up Your Spreadsheet:

    Assume your data is organized with columns like Player, Challenger, Opponent, and Outcome.

    1. Columns Setup:
      • Column A: Player Names
      • Column B: Challenger Names
      • Column C: Opponent Names
      • Column 😧 Outcome (Win or Loss)

    Create a New Column for Match Results:

    1. Column E: Match Result:
      • Use a formula in column E to determine the match result based on the outcome. For example:

    =IF(D2="Win", B2, IF(D2="Loss", C2, ""))

      • This formula will populate the name of the opponent in column E for wins and the challenger for losses.

    Create a New Column for Match Positions:

    1. Column F: Match Position:
      • Use a formula in column F to find the position of the match result in column E:

    =MATCH(E2, A:A, 0)

      • This formula finds the position of the opponent/challenger in the list of players.

    Update the Ranking:

    1. Ranking Column (G):
      • Use the RANK function to create a dynamic ranking based on the match positions:

    =RANK(F2, F:F, 0)

      • This formula assigns a rank to each player based on the match positions.

    Sort the Data:

    1. Sort the Data:
      • Sort the data based on the ranking column (Column G) in descending order.
        • Click on the header of the column you want to sort (e.g., G) and choose "Sort Largest to Smallest."

    Now, as matches are played and outcomes are entered, the ranking will automatically update based on the match results. The text and steps were edited with the help of AI.

     

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

    • JWesty's avatar
      JWesty
      Copper Contributor

      Hi NikolinoDE and many thanks for the quick and helpful reply.

       

      The columns work to highlight the winner, and to locate current position in the ladder (league), which is a good step forward. The ranking though is based on the winner moving above the person that they have beaten, so this is still not working.

       

      It doesn't matter how many points they have, just that the challenger 'leapfrogs' all other players in between their original position and the opponent they have won against. (For this reason, I don't think the sort function is not useful). If the opponent wins, no change in ranking happens.

       

      eg

      1. dave

      2. phil

      3. ian

       

      If Ian challenges and beats dave, he moves ahead on the ladder.

      1. ian

      2. dave

      3. phil

       

       

      Many thanks in advance!

      James

      • NikolinoDE's avatar
        NikolinoDE
        Gold Contributor

        JWesty 

        In this case, if the goal is to create a dynamic ladder where the challenger leapfrogs over the defeated opponent and all players in between, you can implement a more complex solution using Excel formulas.

        Assuming your ladder starts in column A, and the challenger, opponent, and outcome information are in columns B, C, and D respectively, follow these steps:

        Step 1: Identify the Matched Rows

        1. Column E: Matched Rows:
          • Use the following formula in cell E2 and drag it down for all rows:

        =IF(OR(B2="", C2="", D2=""), "", IF(D2="Win", MATCH(C2, $A$2:$A$100, 0), MATCH(B2, $A$2:$A$100, 0)))

          • This formula will find the match positions for wins and losses. If no match is found, it leaves the cell blank.

        Step 2: Determine the New Positions

        1. Column F: New Positions:
          • Use the following formula in cell F2 and drag it down:

        =IF(E2="", "", IF(D2="Win", ROW(B2) + E2 - ROW(C2), ROW(C2) + E2 - ROW(B2)))

          • This formula calculates the new position for the winner (if the outcome is a win) based on the challenger and opponent positions.

        Step 3: Implement the Dynamic Ranking

        1. Column G: Dynamic Ranking:
          • Use the RANK function to create a dynamic ranking based on the new positions:

        =IF(F2="", "", RANK(F2, F:F, 0))

          • This formula assigns a rank to each player based on the new positions.

        Step 4: Display the Ranked Ladder

        1. Display the Ranked Ladder:
          • Use the INDEX and MATCH functions to display the ranked ladder. Assuming your original ladder is in column A, use the following formula in a new column (e.g., H2):

        =IFERROR(INDEX($A$2:$A$100, MATCH(ROW(), $G$2:$G$100, 0)), "")

            • Drag this formula down for all rows.

        Now, as matches are played and outcomes are entered, the ranking will automatically update based on the challenger leapfrogging over the defeated opponent and all players in between.

        This solution assumes that you have a maximum of 100 players in your ladder (adjust the range in formulas as needed). If you have a larger or smaller number of players, adjust the range accordingly.

Resources