+ Reply to Thread
Results 1 to 4 of 4

Sort using AGGREGATE

  1. #1
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Sort using AGGREGATE

    Is it possible to use the AGGREGATE function to sort data without using helper columns?

    I have two columns of data (numbers and letters) from A1:B5

    Please Login or Register  to view this content.
    In C1:D5 I use the AGGREGATE formula (this formula is my own variation) to list non blank values that are in column B

    IFERROR(INDEX($A$1:$B$5,AGGREGATE(15,6,ROW($A$1:$B$5)/(($B$1:$B$5<>"")),ROWS(A$1:A1))-(1-1),COLUMN()-2),"")

    So I get

    Please Login or Register  to view this content.
    I was hoping I could do this

    IFERROR(INDEX($A$1:$B$5,AGGREGATE(15,6,ROW($A$1:$B$5)/(($B$1:$B$5<>"")*($A$1:$A$5={1,2,3,4,5})),ROWS(A$1:A1))-(1-1),1),"")

    dictating the order I want the output in to end up with, effectively sorting the output

    Please Login or Register  to view this content.
    Is there any way to use the AGGREGATE formula to dictate what order you want the results in and doing it within one formula?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Sort using AGGREGATE

    Try this
    In F2

    =IFERROR(AGGREGATE(15,6,$A$2:$A$6/($B$2:$B$6<>""),ROWS($F$2:$F2)),"")

    In G2

    =IFERROR(INDEX($B$2:$B$6,MATCH(F2,$A$2:$A$6,0)),"")

    then drag down.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Sort using AGGREGATE

    one option

    C1:
    =IFERROR(INDEX(A$1:A$5,MOD(AGGREGATE(15,6,(COUNTIF($B$1:$B$5,"<"&$B$1:$B$5)*10000+ROW($A$1:$A$5))/($B$1:$B$5<>""),ROWS(C$1:C1)),10000)),"")
    copied across matrix C1:D5

    edit: ignore the above if the number in A determines order, the above is over complicated for that - i.e. the above returns dataset based on A-Z of Col B....

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Sort using AGGREGATE

    Thanks guys, was hitting a brick wall over this one!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Dynamic Sort via Index/Match/Aggregate
    By datbigdog in forum Excel General
    Replies: 9
    Last Post: 06-15-2019, 09:02 PM
  2. Aggregate by ID in DAX
    By JB_100 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-22-2017, 02:35 AM
  3. Aggregate Function
    By nav505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2013, 03:20 AM
  4. [SOLVED] Aggregate forumla help
    By seanyc in forum Excel General
    Replies: 13
    Last Post: 06-15-2012, 02:42 PM
  5. Aggregate error
    By TomBP in forum Access Tables & Databases
    Replies: 3
    Last Post: 12-15-2010, 04:52 PM
  6. Best way to aggregate?
    By gnome_core in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2009, 04:38 PM
  7. [SOLVED] aggregate calculations
    By [email protected] in forum Excel General
    Replies: 0
    Last Post: 05-26-2005, 05:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1