Custom-sort filter array table

freddyt

New Member
Joined
Apr 13, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I have a table on an audits tab created using the filter() formula so that it pulls data from a master list sheet. I want to be able to sort the data on the audits sheet without using formulas, instead using the common filter dropdown. I've tried to do this and get the error " can't change part of an array", so I'm looking for a way to achieve this purpose. I tried advanced filter and VBA so that whenever the master list changes, I can refresh the audits sheet to reflect the changes but that doesn't work either. Is there a way to do this and still be able to sort the audits sheet results?
 

Attachments

  • Master List.png
    Master List.png
    73.9 KB · Views: 13
  • Filter Results.png
    Filter Results.png
    88 KB · Views: 12
Here is me looking up data from another table and adding it to the filter, and keeping the sort working (and stealing Kevin's better way of identifying the sort parameter:
MrExcelPlayground16.xlsx
ABCDEFGHIJKL
1NameExit DateReasonExit DateNameExit DateReasonHeightNameHeight
2John1/1/2023Fired for Incompentence1/10/2023Fred1/10/2023Quiet Quit65John73
3John1/2/2023Smells2/15/2023Fred1/11/2023Fired for Incompentence65Fred65
4John1/3/2023RetiredFred1/12/2023Smells65Harry69
5John1/4/2023Better JobFred1/13/2023Better Job65George71
6John1/5/2023Own BusinessFred1/14/2023Better Job65
7John1/6/2023SmellsHarry1/15/2023Own Business69
8Fred1/7/2023RetiredHarry1/16/2023Quiet Quit69
9Fred1/8/2023Better JobHarry1/17/2023Fired for Incompentence69
10Fred1/9/2023Own BusinessHarry1/18/2023Smells69
11Fred1/10/2023Quiet QuitHarry1/19/2023Complete Jerk69
12Fred1/11/2023Fired for IncompentenceHarry1/20/2023Better Job69
13Fred1/12/2023SmellsHarry1/21/2023Own Business69
14Fred1/13/2023Better JobHarry1/22/2023Quiet Quit69
15Fred1/14/2023Better JobHarry1/23/2023Fired for Incompentence69
16Harry1/15/2023Own BusinessHarry1/24/2023Smells69
17Harry1/16/2023Quiet QuitHarry1/25/2023Quiet Quit69
18Harry1/17/2023Fired for IncompentenceHarry1/26/2023Better Job69
19Harry1/18/2023SmellsGeorge1/27/2023Better Job71
20Harry1/19/2023Complete JerkGeorge1/28/2023Retired71
21Harry1/20/2023Better JobGeorge1/29/2023Better Job71
22Harry1/21/2023Own BusinessGeorge1/30/2023Own Business71
23Harry1/22/2023Quiet QuitGeorge1/31/2023Quiet Quit71
24Harry1/23/2023Fired for IncompentenceGeorge2/1/2023Fired for Incompentence71
25Harry1/24/2023SmellsGeorge2/2/2023Smells71
26Harry1/25/2023Quiet QuitGeorge2/3/2023Retired71
27Harry1/26/2023Better JobGeorge2/4/2023Better Job71
28George1/27/2023Better JobGeorge2/5/2023Own Business71
29George1/28/2023RetiredGeorge2/6/2023Quiet Quit71
30George1/29/2023Better JobFred2/7/2023Fired for Incompentence65
31George1/30/2023Own BusinessFred2/8/2023Smells65
32George1/31/2023Quiet QuitFred2/9/2023Retired65
33George2/1/2023Fired for IncompentenceFred2/10/2023Better Job65
34George2/2/2023SmellsFred2/11/2023Own Business65
35George2/3/2023RetiredFred2/12/2023Quiet Quit65
36George2/4/2023Better JobFred2/13/2023Smells65
37George2/5/2023Own BusinessJohn2/14/2023Retired73
38George2/6/2023Quiet QuitJohn2/15/2023Better Job73
39Fred2/7/2023Fired for Incompentence
40Fred2/8/2023Smells
41Fred2/9/2023Retired
42Fred2/10/2023Better Job
43Fred2/11/2023Own Business
44Fred2/12/2023Quiet Quit
45Fred2/13/2023Smells
46John2/14/2023Retired
47John2/15/2023Better Job
48John2/16/2023Quiet Quit
49John2/17/2023Fired for Incompentence
50John2/18/2023Smells
51John2/19/2023Retired
52Harry2/20/2023Better Job
53John2/21/2023Own Business
54Harry2/22/2023Quiet Quit
55John2/23/2023Fired for Incompentence
56George2/24/2023Smells
57George2/25/2023Retired
58George2/26/2023Better Job
59Fred2/27/2023Better Job
60Fred2/28/2023Own Business
61Fred3/1/2023Quiet Quit
62Fred3/2/2023Fired for Incompentence
63Fred3/3/2023Smells
64John3/4/2023Retired
Sheet15
Cell Formulas
RangeFormula
F2:I38F2=LET(a,FILTER(A2:C64,(B2:B64>=E2)*(B2:B64<=E3)),b,XMATCH(E1,F1:I1),c,XLOOKUP(TAKE(a,,1),K2:K5,L2:L5,,0),d,HSTACK(a,c),SORT(d,b))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
E1List=$F$1:$I$1
@JamesCanale what do a,b, c, and d represent in your data?
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I'm bad at naming variables. It goes back to my commodore 64 days...

a is simply the filtered data table. b is the number of the column of that matches the drop-down - for use in the SORT at the end. c is the column of looked up heights - you can see it looks up from the first TAKEn column of a (the names) and looks in the secondary data table of peoples heights. d is a merged table of the first filtered set (a) and the appended heights (c). Then the sort of the merged data table (d) by the column that matches the drop down.
 
Upvote 0
I'm bad at naming variables. It goes back to my commodore 64 days...

a is simply the filtered data table. b is the number of the column of that matches the drop-down - for use in the SORT at the end. c is the column of looked up heights - you can see it looks up from the first TAKEn column of a (the names) and looks in the secondary data table of peoples heights. d is a merged table of the first filtered set (a) and the appended heights (c). Then the sort of the merged data table (d) by the column that matches the drop down.

I'm bad at naming variables. It goes back to my commodore 64 days...

a is simply the filtered data table. b is the number of the column of that matches the drop-down - for use in the SORT at the end. c is the column of looked up heights - you can see it looks up from the first TAKEn column of a (the names) and looks in the secondary data table of peoples heights. d is a merged table of the first filtered set (a) and the appended heights (c). Then the sort of the merged data table (d) by the column that matches the drop down.
@JamesCanale Can you please humor me and do the same with my table?

Task Tracker Rebuild v1.xlsx
ABCDEFGHIJKLMNOPQRST
1SORTENGINEER
2
3RMCOMPANYCITYTYPEAPPROVALAPPROVAL DATEQSTRMAUDIT DATEENGINEERREGIONTASKSURVEY DATEDRAWING DATEASSIGNED TOSTATUSNOTES
4254VestibuleOutthereVCR10928615AE3355Jan 7, 1900Jan 2, 190043060AbeSouthSurveyMay need a survey to determine adequacy.
5226BeachesPeachesAirplanes11530902BC1920Jan 12, 1900Jan 2, 190043119JimSouthSurveySurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
6498CashGlasgowTapes10727854AD3277Jan 17, 1900Jan 3, 190041940JohnNorthSurveySurvey this site second. Dustin recommends 2 people attend all site visits.
7404DiariesOuthouseDogs11731664BD9637Jan 7, 1900Jan 2, 190042664JudasSouthSurveyDrawing started, waiting for feedback from Bryce about location of HP and berms.
8344LeyserDenmarkCDs10527091AC1348Jan 6, 1900Jan 3, 190042933LukeNorthSurveyEngineer to discuss with Client.
9435FenderHerefordMovies10326331AB2346Jan 9, 1900Jan 3, 190042956MarkNorthSurveyMay need a survey to determine adequacy.
10395FeedingPlainsMusic10125569AA1224Jan 8, 1900Jan 3, 190043403MatNorthSurveySurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
11588BarsMeadowsCows11330139BB6##Jan 17, 1900Jan 2, 190043336MoSouthSurveySurvey this site second. Dustin recommends 2 people attend all site visits.
12344PeaveyDalmatianCars11129378BA2989Jan 6, 1900Jan 2, 190043397ZackSouthSurveyDrawing started, waiting for feedback from Bryce about location of HP and berms.
Surveys
Cell Formulas
RangeFormula
A4:O12A4=IF(SORT(FILTER(Table2,Table2[TASK]="Survey"),XMATCH(B1,A3:S3))="","",SORT(FILTER(Table2,Table2[TASK]="Survey"),XMATCH(B1,A3:S3)))
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
L4:L12ListBryce, Chantel, Chris, Cory, Dustin, Lee, Peta-Gay, Priscila, Sheldon
N4:N12ListSurvey, Drawing, Complete
B1List=$A$3:$S$3
O3ListAudit, Re-Inspection, Compliance, Application, Approval, Survey, Complaint, Site Inspection
 
Upvote 0
post your original data from table2; and the other table you want to connect to it.
 
Upvote 0
post your original data from table2; and the other table you want to connect to it.
This is the original data. It'll be filtered to another tab based on the task.

Task Tracker Rebuild v1.xlsx
ABCDEFGHIJKLMNO
1RMCOMPANYCITYTYPEAPPROVALAPPROVAL DATEQSTRMAUDIT DATEENGINEERREGIONTASK
2395FeedingPlainsMusic101Jan 1, 1970AA122483Oct 30, 2018MatNorthSurvey
3435FenderHerefordMovies103Feb 2, 1972AB234693Aug 9, 2017MarkNorthSurvey
4344LeyserDenmarkCDs105Mar 3, 1974AC134863Jul 17, 2017LukeNorthSurvey
5498CashGlasgowTapes107Apr 4, 1976AD3277173Oct 28, 2014JohnNorthSurvey
6254VestibuleOutthereVCR109May 5, 1978AE335572Nov 21, 2017AbeSouthSurvey
7344PeaveyDalmatianCars111Jun 6, 1980BA298962Oct 24, 2018ZackSouthSurvey
8588BarsMeadowsCows113Jul 7, 1982BB6106172Aug 24, 2018MoSouthSurvey
9226BeachesPeachesAirplanes115Aug 8, 1984BC1920122Jan 19, 2018JimSouthSurvey
10404DiariesOuthouseDogs117Sep 9, 1986BD963772Oct 21, 2016JudasSouthSurvey
11
Master List
Cells with Data Validation
CellAllowCriteria
N2:N11ListNorth, South
O2:O11ListAudit, Re-Inspection, Compliance, Application, Approval, Survey, Complaint


This is the data on the tab where the original data is filtered to.

Task Tracker Rebuild v1.xlsx
PQRST
3SURVEY DATEDRAWING DATEASSIGNED TOSTATUSNOTES
4Nov 21, 2017Nov 21, 2017AbeCompleteMay need a survey to determine adequacy.
5Jan 19, 2018Jan 19, 2018JimIn ProgressSurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
6Oct 28, 2014Oct 28, 2014JohnOh HoldSurvey this site second. Dustin recommends 2 people attend all site visits.
7Oct 21, 2016Oct 21, 2016JudasCompleteDrawing started, waiting for feedback from Bryce about location of HP and berms.
8Jul 17, 2017Jul 17, 2017LukeIn ProgressEngineer to discuss with Client.
9Aug 9, 2017Aug 9, 2017MarkOh HoldMay need a survey to determine adequacy.
10Oct 30, 2018Oct 30, 2018MatCompleteSurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
11Aug 24, 2018Aug 24, 2018MoIn ProgressSurvey this site second. Dustin recommends 2 people attend all site visits.
12Oct 24, 2018Oct 24, 2018ZackOh HoldDrawing started, waiting for feedback from Bryce about location of HP and berms.
Surveys
 
Upvote 0
How is this supposed to be connected? This information on Survey Date, Drawing Date...Notes connected to the RM number (Column A).

I my simple example, I had Name, Date, Reason in the main data table - and filtered it by a date range. In the second data table I had name and height as a smaller lookup table. So I was able to connect the tables because name was in both of them.

I gather that someone had the filter going and then just put more data next to it. That won't work. If there was a secondary table that was "Survey Info", and linked by some key like "RM" - then they could all be pulled together and sorted nicely.

The short of it is: you can't just put new notes next to a filtered set and expect excel to be able to deal with it for sorting purposes.

So if that bottom table of survey information was somewhere else, and had a column with "RM" numbers to link up, you would be in business.
 
Upvote 0
How is this supposed to be connected? This information on Survey Date, Drawing Date...Notes connected to the RM number (Column A).

I my simple example, I had Name, Date, Reason in the main data table - and filtered it by a date range. In the second data table I had name and height as a smaller lookup table. So I was able to connect the tables because name was in both of them.

I gather that someone had the filter going and then just put more data next to it. That won't work. If there was a secondary table that was "Survey Info", and linked by some key like "RM" - then they could all be pulled together and sorted nicely.

The short of it is: you can't just put new notes next to a filtered set and expect excel to be able to deal with it for sorting purposes.

So if that bottom table of survey information was somewhere else, and had a column with "RM" numbers to link up, you would be in business.
Riiight! And herein lies my problem. Thing is I have six different tasks with their own sheets, so I'd have to create another tab for each one to link to the filtered set. In that case I might as well not have a master list and just add text without formulas, no?
 
Upvote 0
I might put it all together and then use the native sort and filtering to filter the data and then sort in one big filtered table.
 
Upvote 0
WOW James, beautiful formula. You make great use of the new functions and I'm learning from your work. Thank you!
 
Upvote 0
Hi Gentlemen! After much daydreaming I figured out a workaround this issue. The only thing I don't like about it is the blank cells returned if criteria aren't met. How do I get the results stacked one row after another instead of the blanks?

Task Tracker Rebuild v1.xlsx
ABCDEFGHIJKLMNOPQRST
3RMCOMPANYCITYTYPEAPPROVALAPPROVAL DATEQSTRMAUDIT DATEENGINEERREGIONTASKSURVEY DATEDRAWING DATEASSIGNED TOSTATUSNOTES
4395FeedingPlainsMusic10125569AA12248343403MatNorthSurvey4306043060AbeCompleteMay need a survey to determine adequacy.
5               4293342933LukeIn ProgressEngineer to discuss with Client.
6344LeyserDenmarkCDs10527091AC13486342933LukeNorthSurvey4333643336MoIn ProgressSurvey this site second. Dustin recommends 2 people attend all site visits.
7498CashGlasgowTapes10727854AD327717341940JohnNorthSurvey4295642956MarkOh HoldMay need a survey to determine adequacy.
8               4339743397ZackOh HoldDrawing started, waiting for feedback from Bryce about location of HP and berms.
9344PeaveyDalmatianCars11129378BA29896243397ZackSouthSurvey4311943119JimIn ProgressSurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
10588BarsMeadowsCows11330139BB610617243336MoSouthSurvey4340343403MatCompleteSurvey this site first before starting the other site. Dustin recommends 2 people attend all site visits.
11               4266442664JudasCompleteDrawing started, waiting for feedback from Bryce about location of HP and berms.
12404DiariesOuthouseDogs11731664BD96377242664JudasSouthSurvey4194041940JohnOh HoldSurvey this site second. Dustin recommends 2 people attend all site visits.
Sheet1
Cell Formulas
RangeFormula
A4:O12A4=IF('Master List'!$O2="Survey",'Master List'!A2,"")
 
Upvote 0

Forum statistics

Threads
1,215,215
Messages
6,123,668
Members
449,114
Latest member
aides

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