Rank From Highest To Lowest With Ties

Input collection: myHighScores28

NameValue
Jim Anderson100
Winnie Lee78
Jane Nelson100
Anders Erickson135
Timothy Green15
Elizabeth Martin50


Output collection: mySolution28

NameValue
Anders Erickson135
Jim Anderson100
Jane Nelson100
Winnie Lee75
Elizabeth Martin50
Timothy Green15


Solution code:

//Create a collection
ClearCollect(myHighScores28,
{Name: "Jim Anderson", Value: 100},
{Name: "Winnie Lee", Value: 75},
{Name: "Jane Nelson", Value: 100},
{Name: "Anders Erickson", Value: 135},
{Name: "Timothy Green", Value: 15},
{Name: "Elizabeth Martin", Value: 50}
);

//Rank from highest to lowest code
ClearCollect(
    myCountedValues,
    Sort(
        AddColumns(
            GroupBy(myHighScores28,"Value","GroupedValues"),
        "CountValue",CountRows(GroupedValues)
        ),
    Value,Descending
    )
);

//Rank counter collection
ClearCollect(rowCounter,{Value:1});

//Rank from highest to lowest code continued
Clear(myRankedValues);
ForAll(
    myCountedValues,
    Collect(
        myRankedValues,
        {
            RankNumber: First(rowCounter).Value,
            Value: myCountedValues[@Value],
            CountValue: myCountedValues[@CountValue],
            GroupedValues: myCountedValues[@GroupedValues]
        });
    Patch(
        rowCounter,
        First(rowCounter),
        {Value: First(Sort(myRankedValues,RankNumber,Descending)).RankNumber + CountValue}
    );
);

ClearCollect(
    mySolution28,
    Sort(
        DropColumns(Ungroup(myRankedValues,"GroupedValues"),"CountValue"),
        RankNumber,
        Ascending
    )
);