Steve
Steve

Reputation: 31

Sort result of function by RHS column

I have a formula that pulls a list of unique names on my spreadsheet, and then transposes them so they display vertically.

Next to that column of displayed names, I have a SumProduct formula, that adds all the numerical values that are next to the names throughout the spreadsheet

tl;dr left column transposed data, right column pull numbers based on the left column.

I need to find a way to sort both columns, based on the data in the right column, highest number at the top.

Apologies if I've explained this poorly.

Thanks

Upvotes: -1

Views: 47

Answers (1)

Babanana
Babanana

Reputation: 1476

Sorting Results and Ranges in Google Sheet

Since you are pulling data from another sheet, it could affect how to sort the values.

If you have a helper column, you can easily use the Sort Function.

Try this:

=SORT(A1:B6,B1:B6,FALSE)

This formula should be pasted outside the range of the column that you will use as a base of the data.

Sample Output Same Sheet

Raw Data Sort Result
Iron Man 12 Vision 122
Vision 122 Iron Man 12
Captain America 11 Captain America 11
Hawk Eye 2 Black Widow 4
Black Widow 4 Thanos 3
Thanos 3 Hawk Eye 2

Another Approach will be using LET, HSTACK and SORT.

Try this:

You just need to change the formula on the Let, to use your own formula that you use to get data. Please change the placeholders accordingly. The Formula expects a formula that returns an array of data.

=LET(z, "Your Formula to get Unique Names", y, "Your Formula to get the Sumproducts", SORT(HSTACK(z,y),y,FALSE) )

Sample Output

Vision 122
Iron Man 12
Captain America 11
Black Widow 4
Thanos 3
Hawk Eye 2

References:

Let

Sort

Upvotes: 2

Related Questions