Sort Dynamic Spill Array Formula by Criteria

TheMacroNoob

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

I have a dynamic spill array that pumps out values matching various criteria.
In my example below, my spilled array returns four values (IDs), and in the next 4 columns I grab additional information with XLOOKUPS based on those values.

Is there any way to sort my spill array by the proceeds changes column? As it stands, that is a circular reference and SORTBY doesn't work by referencing those cells, so I'm not sure how to achieve the desired result.

Cell Formulas
RangeFormula
B21:B24B21=FILTER(IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,""),IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,"")<>"","")
C21:C25C21=XLOOKUP(B21,Data[PID],Data[Property],"")
D21:D25D21=XLOOKUP(B21,Year_Changes[PID],Year_Changes[Changes D1-D2],"")
E21:E24E21=XLOOKUP(B21,Status[PID],Status[D2])
F21:F25F21=IFNA(IFS(D21="Moved to 2021 from 2020",-XLOOKUP(B21,Data[PID],Data[P1]),D21="Property Added to 2020",XLOOKUP(B21,Data[PID],Data[P2])),"")
Dynamic array formulas.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Can you use SORT?
=SORT(FILTER(IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,""),IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,"")<>"",""),5,-1)
 
Upvote 0
Can you use SORT?
=SORT(FILTER(IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,""),IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,"")<>"",""),5,-1)
Doesn't work, provides a #VALUE error as entered. Maybe there is no dynamic way to do this because of the circular reference issue
 
Upvote 0
How about
Excel Formula:
=let(f,FILTER(IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,""),IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,"")<>"",""),d,XLOOKUP(f,Year_Changes[PID],Year_Changes[Changes D1-D2],""),SORT(VSTACK(f,XLOOKUP(f,Data[PID],Data[Property],""),d,XLOOKUP(f,Status[PID],Status[D2]),IFNA(IFS(d="Moved to 2021 from 2020",-XLOOKUP(f,Data[PID],Data[P1]),d="Property Added to 2020",XLOOKUP(f,Data[PID],Data[P2])),"")),5,-1))
 
Upvote 0
Solution
How about
Excel Formula:
=let(f,FILTER(IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,""),IFS(Year_Changes[Changes D1-D2]="Property Added to 2020",Year_Changes[PID],Year_Changes[Changes D1-D2]="Moved to 2021 from 2020",Year_Changes[PID],TRUE,"")<>"",""),d,XLOOKUP(f,Year_Changes[PID],Year_Changes[Changes D1-D2],""),SORT(VSTACK(f,XLOOKUP(f,Data[PID],Data[Property],""),d,XLOOKUP(f,Status[PID],Status[D2]),IFNA(IFS(d="Moved to 2021 from 2020",-XLOOKUP(f,Data[PID],Data[P1]),d="Property Added to 2020",XLOOKUP(f,Data[PID],Data[P2])),"")),5,-1))
This didn't quite work for me for unknown reasons, it resulted in a value error, but I know what you are doing with the LET and I was able to get it to work for me. Thank you!
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,537
Messages
6,125,390
Members
449,222
Latest member
taner zz

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