Apply a dynamic include/exclude in outer FILTER formula to dynamically determine which columns to return

AOB

Well-known Member
Joined
Dec 15, 2010
Messages
660
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I'm playing around with the FILTER formula and trying to see if I can get something to work...

So I've set up an initial table and then have a formula that shows a filtered view of that table based on some condition :

Excel Formula:
=IFERROR(FILTER(tblSomeTable,tblSomeTable[SomeField]>0,""),"No Items")

Next I'm wrapping that inside a second FILTER to include/exclude columns based on their index/position in the table :

Excel Formula:
=IFERROR(FILTER(FILTER(tblSomeTable,tblSomeTable[SomeField]>0,""),{1,0,1,1,1,0}),"No Items")

All working beautifully, as expected

Now - what I'm trying to do is have that include/exclude array - the {1,0,1,1,1,0} part of the outer FILTER - applied dynamically.

In other words, if I have that sequence in a cell somewhere (named range, whatever) - can I refer to that cell, and apply its value into the outer FILTER formula, rather than "hard-coding" it into the formula?

I already have a cell with the array formatted exactly the way it needs to appear within the formula - I just don't know how to refer to it?

Am thinking there must be a way á la INDIRECT or something along those lines?

Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I doubt that is the best setup but you could put the comma separated list of numbers (1,0,1,1,1,0) into a cell, say J1, and then use TEXTSPLIT(J1,",")+0 as the array
 
  • Like
Reactions: AOB
Upvote 1
Solution
I doubt that is the best setup but you could put the comma separated list of numbers (1,0,1,1,1,0) into a cell, say J1, and then use TEXTSPLIT(J1,",")+0 as the array
LOL - yeah, I totally appreciate your concern, I am really just toying around with the functionality to see what it can do

That (of course) works perfectly, thank you so much!

(Might I ask the significance of the "+0" at the end?...)
 
Upvote 0
Might I ask the significance of the "+0" at the end?
TEXTSPLIT always returns text, but you need numbers, so adding 0 coerces the "1" and "0" to actual 1 and 0
 
  • Like
Reactions: AOB
Upvote 0
TEXTSPLIT always returns text, but you need numbers, so adding 0 coerces the "1" and "0" to actual 1 and 0
Ahhh, of course, yes indeed - excellent, thanks for explaining!
 
Upvote 0

Forum statistics

Threads
1,215,278
Messages
6,124,021
Members
449,139
Latest member
sramesh1024

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