using choosecols() instead of using an array of {1,0,0,1} type within a filter

etaf

Well-known Member
Joined
Oct 24, 2012
Messages
8,314
Office Version
  1. 365
Platform
  1. MacOS
i have just seen here
a way to instead of using an array of
{1,0,1,0,0,0,0,1,1,1}
in a filter
to show columns based on a FILTER
that a CHOOSECOLS()
is used , and just provide the numbers of the columns needed


I have used this type of array if i dont want to show all the columns , quite a few times in different spreadsheets in use, with different formulas - but all use
FILTER(FILTER(),{1,1,0,0})

and i cant seem to get to work with this particular array

=SORT(FILTER(FILTER(Active!$A$1:$Q$500,(Active!$P$1:$P$500<=F1/100)*(Active!$P$1:$P$500<>"")),{1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0}),(1))

perhaps it does not apply to this FILTER / FILTER option

or maybe a much better way to do it

Not in a hurry , as i say i noticed a possible better solution

CM test Sheet - bug correction - VERSION 2.1.xlsx
EFGHIJK
1Clients under20% <- enter the Number - NOT a Percent - EG for 35%, just type in 35 - Trust Balance to Minimum Retainer % required to extract the summary below
2headerA HeaderK headerL Header M Header N Header O Header P
3Flinstone, Fred$ 2,000.00$ -$ 20.00$ 200.00$ 2,220.00-11%
4name-12$ 10,000.00$ -$ -$ 12.00$ 10,012.000%
5name-13$ 10,000.00$ 1,000.00$ 130.50$ -$ 9,130.509%
6name-15$ 10,000.00$ 6,000.00$ 7,000.00$ -$ 11,000.00-10%
7name-3$ 10,000.00$ 9,000.00$ 9,000.00$ -$ 10,000.000%
8name-7$ 10,000.00$ -$ -$ 12.00$ 10,012.000%
Summary
Cell Formulas
RangeFormula
E3:K8E3=SORT(FILTER(FILTER(Active!$A$1:$Q$500,(Active!$P$1:$P$500<=F1/100)*(Active!$P$1:$P$500<>"")),{1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0}),(1))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Active!_FilterDatabase=Active!$A$1:$Q$6E3
Active!Print_Titles=Active!$1:$1E3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E3:K201Expression=$E3<>""textNO



CM test Sheet - bug correction - VERSION 2.1.xlsx
ABCDEFGHIJKLMNOPQ
1HeaderAHeader1Header2Header3Header4Header5Header6Header7Header8Header9HeaderKheaderLHeader MHeader NHeader OHeader PHeader16
2Flinstone, FredPSAPWC CC$2,000.00$0.00$20.00$200.00$2,220.00-11.000%1/3/23
3name-1$10,000.00$9,000.00$10.00$0.00$1,010.0089.900%2/21/23
4name-10$10,000.00$10,000.00$0.00$0.00$0.00100.000%1/31/23
5name-11$10,000.00$2,300.00$0.00$0.00$7,700.0023.000%2/21/23
6name-12$10,000.00$0.00$0.00$12.00$10,012.00-0.120%2/13/23
7name-13$10,000.00$1,000.00$130.50$0.00$9,130.508.695%2/3/23
8name-14$10,000.00$4,000.00$775.50$0.00$6,775.5032.245%2/14/23
9name-15$10,000.00$6,000.00$7,000.00$0.00$11,000.00-10.000%1/31/23
10name-2Closed$0.00$0.00$12.00$12.00Closed2/13/23
11name-3$10,000.00$9,000.00$9,000.00$0.00$10,000.000.000%2/3/23
12name-4$10,000.00$7,500.00$775.50$0.00$3,275.5067.245%2/14/23
Active
Cell Formulas
RangeFormula
O2:O12O2=IF(A2="","",SUM(K2)-(L2-M2)+(N2))
P2:P12P2=IFERROR(IF(K2="Closed","Closed",((L2-M2-N2)/K2)),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L2:O19,L21:O500Expression=$K2="closed"textNO
A2:Q19,A21:Q500,A20:J20,Q20Expression=$P2="closed"textYES
A2:Q19,A21:Q500,A20:J20,Q20Expression=$N2>0textYES
A2:Q19,A21:Q500,A20:J20,Q20Expression=AND($L2<>"",($L2-$M2)<=0)textNO
A2:Q19,A21:Q500,A20:J20,Q20Expression=AND($P2<>"",$P2<=0.25)textNO
A2:Q19,A21:Q500,A20:J20,Q20Expression=AND($P2<>"",$P2<=0.5)textNO
A2:Q19,A21:Q500,A20:J20,Q20Expression=AND($P2<>"",$P2<=0.75)textNO
Cells with Data Validation
CellAllowCriteria
C2:C12List=Reference!$A$2:$A$13
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
The Choosecols approach works for me like
Fluff.xlsm
EFGHIJK
1Clients under35 <- enter the Number - NOT a Percent - EG for 35%, just type in 35 - Trust Balance to Minimum Retainer % required to extract the summary below
2headerA HeaderK headerL Header M Header N Header O Header P
3Flinstone, Fred20000202002220-0.11
4name-111000023000077000.23
5name-1210000001210012-0.0012
6name-13100001000130.509130.50.08695
7name-14100004000775.506775.50.32245
8name-151000060007000011000-0.1
9name-310000900090000100000
Dashboard
Cell Formulas
RangeFormula
E3:K9E3=SORT(CHOOSECOLS(FILTER(Active!$A$1:$Q$500,(Active!$P$1:$P$500<=F1/100)*(Active!$P$1:$P$500<>"")),1,11,12,13,14,15,16),(1))
Dynamic array formulas.
 
Upvote 0
Solution
cool, thank you so much and for the quick response
I was applying in the wrong place

Brilliant, i can modify a few formulas now
and even possibly use some sort of indirect to get the columns to view from a cell maybe
 
Upvote 0
If your headers are an exact match you could use
Fluff.xlsm
EFGHIJK
1Clients under35 <- enter the Number - NOT a Percent - EG for 35%, just type in 35 - Trust Balance to Minimum Retainer % required to extract the summary below
2headerAHeaderKheaderLHeader OHeader PHeader NHeader M
3Flinstone, Fred200002220-0.1120020
4name-1110000230077000.2300
5name-1210000010012-0.0012120
6name-131000010009130.50.086950130.5
7name-141000040006775.50.322450775.5
8name-1510000600011000-0.107000
9name-310000900010000009000
Dashboard
Cell Formulas
RangeFormula
E3:K9E3=SORT(CHOOSECOLS(FILTER(Active!$A$1:$Q$500,(Active!$P$1:$P$500<=F1/100)*(Active!$P$1:$P$500<>"")),XMATCH(E2:K2,Active!A1:Q1,0)),(1))
Dynamic array formulas.
 
Upvote 0
wow - i will have a sit down and coffee and work through that , and see if i can apply to the none sensitised real sheet, looks easy - but then all your solutions look easy - often when you use LET() ,

yes the headers are very often the same and used in a summary or even more spreadsheet

or answering questions here and other forums ;);)
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0
ok, that worked with the real data - thank you - even with some long text header

any speed advantage ??? to any of the formulas or just like a lot of excel - multiple wys to achieve same result

will make it a lot easier to match headers - no need to count columns or work out 1's and 0's
i end up putting numbers in all the columns
 
Upvote 0
I've no idea what the speed difference is, but I suspect it will be pretty negligible.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,035
Members
449,092
Latest member
ikke

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