Sort multiple criteria combined with filter

ausswe

New Member
Joined
Feb 19, 2013
Messages
46
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,
I've been trying to get my head around how to sort (by multiple criteria) in a filter but can't seem to get it to work.
The original filter also included CHOOSECOLS but I have tried to remove that to troubleshoot but without success.

The filter (pulling data from a sheet named DATA) is working on its own:
FILTER(DATA;DATA[YEAR]=A7;"No results")

I have tried to use SORTBY but I keep getting #VALUE (found a post suggesting to use SORT BY as someting like this: SORTBY(A5:D14;D5:D14;1;C5:C14;-1) and then I found a post suggesting that SORTBY should come after the inital filter:
FILTER(SORTBY(DATA;DATA[[#All];[YEAR]]=A7;"No results");DATA[[#All];[YEAR]];1;DATA[[#All];[MODEL]];1)
This gives me the error that I have too many arguments.
I have tried to change order of the arguments but have been unsuccessful.

Checking if anyone would have any suggestions on what I'm missing.

Thanks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How about
Excel Formula:
=sort(FILTER(DATA;DATA[YEAR]=A7;"No results");{4\3},{-1\1})
 
Upvote 0
How about
Excel Formula:
=sort(FILTER(DATA;DATA[YEAR]=A7;"No results");{4\3},{-1\1})
Thanks Fluff - that seems to work!
I haven't come across that one when I've been searching.

I tried to replace column 4 and 3 with NamedRanges that I use to make it easier for users to sort the data but that doesn't seem to work:
Excel Formula:
=sort(FILTER(DATA;DATA[YEAR]=A7;"No results");{Sort1\Sort2},{-1\1})

That is something that might not be an option when using {4\3} perhaps?
 
Upvote 0
You cannot use named ranges in an array constant, but try
Excel Formula:
=sort(FILTER(DATA;DATA[YEAR]=A7;"No results");hstack(Sort1;Sort2),{-1\1})
 
Upvote 0
Solution
Thank you for your help Fluff - that seems to work fine!
Now I will read up on HSTACK! :)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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