SORT with UNIQUE, but not on UNIQUE column?

slam

Well-known Member
Joined
Sep 16, 2002
Messages
919
Office Version
  1. 365
  2. 2019
Sorry of that title is confusing.

I have this formula in A15:

Excel Formula:
=UNIQUE(FILTER(G2:G400, G2:G400<>""))

Then in B15, I have this formula:

Excel Formula:
=SUMIF(G:G,A15,H:H)/COUNTIF(G:G,A15)

I want to sort this, but by column B, not by column A. Is this possible when using a UNIQUE array? I couldn't do it with the built in Sort functionality, but perhaps there's a way to add SORT to the formula?

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about in A15 only
Excel Formula:
=LET(u,UNIQUE(FILTER(G2:G400,G2:G400<>"")),SORT(HSTACK(u,AVERAGEIFS(H:H,G:G,u)),2))
 
Upvote 1
Solution
Hi Fluff,

Thanks for the reply. I'm assuming that's an array formula, but when I enter it, its showing each value from column G many more times than it actually occurs. Incidentally, it's filling down to the correct number of rows that match the number of unique values from column G, but it's only showing 4 of the unique values (repeated many times) whereas there's actually 64 unique values.

If it's relevant, this is in Excel 365, and the formula in column G2 is:

Excel Formula:
=IFERROR(VLOOKUP(F2,Attributes!A:C,3,FALSE),"")

Thanks
 
Upvote 0
Did you just put the formula in A15 ONLY?
 
Upvote 1
I tried that, but it doesn't auto populate the other cells; I dragged it down, so maybe that was one mistake.
 
Upvote 0
Did you enter it with Ctrl Shift Enter? If so don't, just use Enter.
 
Upvote 1
Are you trying to put the formula into a Table, or just a normal range?
 
Upvote 1
Okay, that clued me in; perhaps it was a range from something I just did previously, so I started from scratch, and now it populated with a normal Enter. I reversed the sort order with a -1 at the end of the formula, and now it's perfect. Thank you so much for your help and patience!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,172
Members
452,893
Latest member
denay

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