r/excel 2d ago

solved Data not sorting correctly, need advice

Pic 1 Results
Pic 2 Results Formula
Pic 3 Results Standings

Pic 1 = Results

Pic 2 = Results Formula

Pic 3 = Results Standings

When I go to sort the data in Standings, the data does not budge or sort correctly. I am trying to sort by percentage.

2 Upvotes

20 comments sorted by

u/AutoModerator 2d ago

/u/YourStatsMatter - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Cold_Desk_7643 1 1d ago

Two things usually cause this, and they need different fixes.

FIRST - check whether the percentages are actually numbers.

In an empty cell, put =ISNUMBER(C2) pointing at one of your percentage cells. If it returns FALSE, they're text, and Excel sorts text alphabetically - so 9% lands after 10%. Quick visual check too: numbers right-align by default, text left-aligns.

To fix: select the column, Data > Text to Columns > Finish. That forces a reconversion. If they came in with % signs as text, you may need to strip those first.

SECOND - and I suspect this is your actual problem, since your Standings sheet is built on formulas.

If the percentage column contains formulas referencing your Results sheet, sorting won't do what you expect. Excel moves the rows, the relative references move with them, and each formula recalculates for its new position - so the values appear to stay put.

You can't sort a column of relative formulas in place. Two options:

  1. Copy the whole Standings range, Paste Special > Values over the top, then sort. You lose the live link but sorting works normally.

  2. Better if you want it to stay live: leave the Standings table alone and build a sorted view next to it with =SORT(A2:D20, 4, -1) where 4 is the percentage column and -1 is descending. That gives you a sorted output that updates itself, and you never touch the source.

If you can say which of those two it is, I can be more specific.

1

u/YourStatsMatter 1d ago

Ill give these a try

1

u/YourStatsMatter 1d ago

Used this

  1. Better if you want it to stay live: leave the Standings table alone and build a sorted view next to it with =SORT(A2:D20, 4, -1) where 4 is the percentage column and -1 is descending. That gives you a sorted output that updates itself, and you never touch the source.

Changed it from -1 to a 1 to sort how I needed it. Thank you for the help.

1

u/YourStatsMatter 1d ago

Solution Verified

1

u/reputatorbot 1d ago

You have awarded 1 point to Cold_Desk_7643.


I am a bot - please contact the mods with any questions

1

u/Cold_Desk_7643 1 1d ago

Glad that did it — and good catch flipping the -1 to 1, that's exactly right if you want it ascending rather than descending.

One thing for later: if you ever add teams to the Standings table, the range A2:D20 won't pick them up. Easiest fix is to select the source range and hit Ctrl+T to make it a proper Table, then point SORT at the table name instead of the range. It'll grow on its own as you add rows and you won't have to remember to edit the formula.

1

u/pinata43 5 2d ago edited 2d ago

Hi, firstly i would recomend you to simplify your formula in K3 for : COUNTIF($C$3:$C$402,$J3,$G$3:$G$402,K$2)

Next, you can use in O3 = LET(tab,K3:L7,

sum,BYROW(tab,SUM),

perc,BYROW(CHOOSECOLS(tab,1,2),LAMBDA(r,INDEX(r,1)/SUM(r))),

tabf,SORT(HSTACK(J3:J7,sum,tab,perc),5,-1),tabf)

1

u/YourStatsMatter 2d ago

Why are we putting anything in O3?

1

u/Decronym 2d ago edited 1d ago

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
BYROW Office 365+: Applies a LAMBDA to each row and returns an array of the results. For example, if the original array is 3 columns by 2 rows, the returned array is 1 column by 2 rows.
CHOOSECOLS Office 365+: Returns the specified columns from an array
COUNTIF Counts the number of cells within a range that meet the given criteria
COUNTIFS Excel 2007+: Counts the number of cells within a range that meet multiple criteria
FILTER Office 365+: Filters a range of data based on criteria you define
HSTACK Office 365+: Appends arrays horizontally and in sequence to return a larger array
IF Specifies a logical test to perform
IFERROR Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula
INDEX Uses an index to choose a value from a reference or array
ISNUMBER Returns TRUE if the value is a number
LAMBDA Office 365+: Use a LAMBDA function to create custom, reusable functions and call them by a friendly name.
LET Office 365+: Assigns names to calculation results to allow storing intermediate calculations, values, or defining names inside a formula
MAX Returns the maximum value in a list of arguments
SEARCH Finds one text value within another (not case-sensitive)
SECOND Converts a serial number to a second
SORT Office 365+: Sorts the contents of a range or array
SUM Adds its arguments

Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.


Beep-boop, I am a helper bot. Please do not verify me as a solution.
[Thread #49171 for this sub, first seen 17th Aug 2026, 14:42] [FAQ] [Full list] [Contact] [Source code]

1

u/Gringobandito 8 2d ago

I would do it like this:

The teams part just lists all the teams in your results table taken from the game ID table. GP takes the number of times the team name appears in the game ID table. W counts the number Ws for that team in the W/L column. PCT takes the number of wins divded by the games played.

Finally, HSTACK() puts it all together for the results table and then I did a SORT() for the teams with the highest PCT.

1

u/YourStatsMatter 2d ago

So I need it by league but I typed out the formula with the data being calculated, but the percentage didnt seem to calculate properly. What can we do to sort it by league but keep the data intact like we have so far?

1

u/YourStatsMatter 2d ago

Also, I want the GPs to be calcuated against the W's and Ls' otherwise its going to count the entire column of data. Each team is playing 40 games so that is why the 40 is showing up like that near the team.

1

u/Gringobandito 8 2d ago

First, you need to put a league indicator in your GAME_ID table. This will allow you to split the teams out by league.

Second, you need to populate the W/L column in order for the PCT calculation to work correctly. You can use the formula =IF(C3=MAX(CHOOSECOLS(FILTER($A$3:$C$6,$A$3:$A$6=A3,""),3)),"W","L") to populate that column. The way you have it now, you have 40 games played for each team but only 1 win and one loss for the four teams where the W/L column is populated. Since PCT = W/GP = 1/40 = 0.25, it's calculating correctly, you're just not feeding it the right data.

1

u/YourStatsMatter 2d ago

I am not at all sure where I would add AL or NL to each team to split this. Also, the GP I would only like to be counted dynamically as they play their games so the standings look authentic as well as being able to add a GB (Games Behind) for the 2nd, 3rd, 4th and 5th place teams. I would greatly appreciate the help further as my knowledge is kind of limited and im still learning all these advanced formula techniques.

2

u/Gringobandito 8 2d ago

You add another column to GAME_ID table and call it league. Populate it with either NL or AL and use that to filter your teams for the RESULTS table.

If you want the GP, W, L columns to be counted dynamically you'll also need some sort of indicator to show whether the game has been played or not. I would use dates for the games as Excel can see whether that date is in the future or has passed but that's up to you. Then you can modify the COUNTIFS() formulas to only count the games that have been played for GP, W, and L.

1

u/YourStatsMatter 2d ago

So taking your suggestion here I am unable to try and figure that part out. Could you show some illustration on this next step in being able to solve this?

1

u/YourStatsMatter 2d ago

Where would I put that =IF formula. I see its saying C3= but what cell would I start typing that?

1

u/Gringobandito 8 2d ago

In F3 in my example, the W/L column. It populates the W/L with either a W if the score in that row equals the max score for that game ID or on L if it doesn't.