How to SORTBY() a Spill Array

TheMacroNoob

Board Regular
Joined
Aug 5, 2022
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hello excel experts,

I am getting very frustrated by what appears to be a straightforward formula.

I have a dynamic array spilling vertically, and various numbers for several years found via xlookup. I want to be able to sort this data, so I made another table to grab the array of GL accounts, filter out blanks, and sort by various years (which I will have a dropdown list and if statements to do later. (IF(X="2012",SORTBY(XYZ)).

My formula is this: =SORTBY(FILTER(L5#,L5#<>""),N5:N21)
The filtered array works, checking with F9, but I don't know how to make the sort array work. I had it working previously and then it simply started giving me #VALUE! errors instead of spilling the sorted array.

Where am I going wrong?

Cell Formulas
RangeFormula
B5B5=SORTBY(FILTER(L5#,L5#<>""),N5:N21)
L5:L21L5=IF(UNIQUE($J$5:$J$21,TRUE,FALSE)=0,"",UNIQUE($J$5:$J$21,TRUE,FALSE))
M5:M21M5=IFERROR(XLOOKUP(L5,Sheet2!B:B,Sheet2!C:C),"")
N5:Q21N5=IFERROR(XLOOKUP($L5,Sheet2!$B:$B,Sheet2!D:D),"")
Dynamic array formulas.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
How about
Excel Formula:
=SORT(FILTER(L5#:Q5,L5#<>""),3)
 
Upvote 0
Solution
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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