Sort Players By Win Stat

%3CLINGO-SUB%20id%3D%22lingo-sub-1706221%22%20slang%3D%22en-US%22%3ESort%20Players%20By%20Win%20Stat%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1706221%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%20I'm%20a%20pretty%20basic%20user%20when%20it%20comes%20to%20Excel.%20I'm%20currently%20trying%20to%20create%20a%20leaderboard%20that%20automatically%20sorts%20players%20in%20descending%20order%20based%20on%20their%20win%20rate.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20aim%20is%20I%20manually%20adjust%20their%20games%20played%20and%20wins%2C%20which%20(currently%20does)%20automatically%20adjust%20their%20win%20rates%2C%20and%20then%20their%20names%20automatically%20sort%20with%20the%20row%20of%20cells%20that%20contains%20that%20players%20information.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAttached%20is%20an%20example%20of%20the%20data%20I'd%20like%20to%20sort.%20In%20this%20example%2C%20%22Alf%22%20should%20automatically%20go%20to%20the%20top%20of%20the%20list%2C%20since%20he%20has%20the%20highest%20win%20rate.%20%22Greg%22%20should%20automatically%20go%20to%20second%20from%20the%20top%2C%20and%20%22Guy%22%20should%20move%20to%20the%20bottom.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20have%20a%20solution%20for%20this%3F%20I've%20tried%20looking%20it%20up%20but%20to%20no%20avail.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1706221%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1706311%22%20slang%3D%22en-US%22%3ERe%3A%20Sort%20Players%20By%20Win%20Stat%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1706311%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F806677%22%20target%3D%22_blank%22%3E%40BenW95%3C%2FA%3E%26nbsp%3BThis%20would%20require%20a%20small%20piece%20of%20Visual%20Basic%20code%20that%20runs%20every%20time%20something%20changes%20in%20your%20worksheet.%20In%20the%20attached%20workbook%2C%20I've%20added%20a%20such%20a%20%22Worksheet_change%22%20event%20code.%20Right-click%20in%20the%20tab%20name%20for%20Sheet%20and%20press%20%22View%20code%22%20to%20have%20a%20look.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20first%2C%20I%20transformed%20the%20your%20ranking%20list%20to%20a%20structured%20Excel%20table%2C%20called%20Table1.%20This%20also%20puts%20filter%20buttons%20in%20the%20header%20row%2C%20which%20allows%20the%20code%20to%20re-sort%20the%20list%2C%20every%20time%20something%20changes%20anywhere%20within%20Sheet1.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

Hi there, I'm a pretty basic user when it comes to Excel. I'm currently trying to create a leaderboard that automatically sorts players in descending order based on their win rate.

 

The aim is I manually adjust their games played and wins, which (currently does) automatically adjust their win rates, and then their names automatically sort with the row of cells that contains that players information.

 

Attached is an example of the data I'd like to sort. In this example, "Alf" should automatically go to the top of the list, since he has the highest win rate. "Greg" should automatically go to second from the top, and "Guy" should move to the bottom.

 

Does anyone have a solution for this? I've tried looking it up but to no avail.

1 Reply
Highlighted

@BenW95 This would require a small piece of Visual Basic code that runs every time something changes in your worksheet. In the attached workbook, I've added such a "Worksheet_change" event code. Right-click in the tab name for Sheet and press "View code" to have a look.

 

But first, I transformed the your ranking list to a structured Excel table, called Table1. This also puts filter buttons in the header row, which allows the code to re-sort the list, every time something changes anywhere within Sheet1.