Sorting Data

mummbles74

Board Regular
Joined
Nov 14, 2009
Messages
120
Office Version
  1. 365
Platform
  1. Windows
I have read a million different web pages and lost myself down a thousand rabit holes and I am not sure this is even possible but what I am looking to do is sort data by ascending values in Column Y but keep duplicate values in Column A together.

As a very crude example I would want the finished table to look like this:
TagRisk Rank
120
111
219
212
318
317
313
414
413

With it originally looking like this:

TagRisk Rank
120
219
318
317
414
313
413
212
111
 
I have created the formula that I want using the following:

=CONCATENATE("=LET(a,UNIQUE('Maintenance Data'!$A$2:$A$",'Defined Information'!C17,"),b,MAXIFS('Maintenance Data'!$Y$2:$Y$",'Defined Information'!C17,",'Maintenance Data'!$A$2:$A$",'Defined Information'!C17,",a),c,SORTBY(a,b,-1),d,SEQUENCE(ROWS(c)),e,XLOOKUP('Maintenance Data'!$A$2:$A$",'Defined Information'!C17,",c,d),SORTBY('Maintenance Data'!$A$2:$Y$",'Defined Information'!C17,",e,,'Maintenance Data'!$Y$2:$Y$",'Defined Information'!C17,",-1))")

where Defined Information C17 has a row count in it but this obviously only returns a text string, is there a way to use the INDIRECT function to create a formula from this?
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Is this because you don't want to see a bunch of zeros at the end of your output?
 
Upvote 0
This should accommodate less than 20,000 (or any larger number) rows of data without pesty zeros.

MrExcelPlayground8-1.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1TagRisk RankTagRisk Rank
2111219
3212212
4313115
5413111
6414414
7310413
8310313
9219310
10115310
Sheet20
Cell Formulas
RangeFormula
AA2:AB10AA2=LET(x,OFFSET(A2,0,0,SUM(--(A2:A20000<>"")),1),y,OFFSET(Y2,0,0,SUM(--(Y2:Y20000<>"")),1),z,INDEX(OFFSET(A2,0,0,SUM(--(A2:A20000<>"")),25),SEQUENCE(SUM(--(A2:A20000<>""))),{1,25}),a,UNIQUE(x),b,MAXIFS(y,x,a),c,SORTBY(a,b,-1),d,SEQUENCE(ROWS(c)),e,XLOOKUP(x,c,d),SORTBY(z,e,,y,-1))
Dynamic array formulas.
 
Upvote 0
This should accommodate less than 20,000 (or any larger number) rows of data without pesty zeros.
Thank you James, the formula is entered on a sheet called Sorted Data but references the range on a separate tab called maintenance Data, the formula transposes the data in the spread sheet on the first tab to a sorted version on the Sorted Data tab. as with the previous posts the data is then remerged. to present the data to the client in there required format and yes I am just trying to get rid of all the zeros at the bottom
 
Upvote 0

Forum statistics

Threads
1,214,801
Messages
6,121,644
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top