Nesting in the FILTER function

TJW17

New Member
Joined
Mar 5, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a filter formula that references a column on a second sheet.

I'd like to be able to select a different column from a drop down box on the search sheet, and I've created a small look up table so that if you select "Description" in the drop down box on the search sheet, cell J3 in the Items page will show Items!D4:D7000, and if you select "Item" in the drop down box, J3 will show Items!C4:C7000.

=FILTER(Items!B4:G7000,ISNUMBER(SEARCH(B3,Items!D4:D7000))*(B3<>""),"No results")

When I change D4:D7000 in the Filter formula to Items!J3 , I get the #VALUE! result.

I've also tried adding in the VLOOKUP formula into the space where D4:D7000 is, but the same thing happens.

=VLOOKUP('Search Sheet'!D3,Items!I7:J12,2,FALSE)

I even tried changing the LOOKUP to an IF function based on the same small table in case the FITLER didn't like the LOOKUP

=IF('Search Sheet'!D3="Description",J9,"N/A")

Is there a way to "nest" a range referenced from another cell into the FILTER formula without resorting to VBA?

Any help would be greatly appreciated!
 

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.
Not following you 100% but is something like this your ultimate aim?
Book1
CDEFGHIJ
3ItemDescriptionColumn C
4Column CColumn DColumn C
5Column CColumn DColumn C
6Column CColumn DColumn C
7Column CColumn DColumn C
8Column CColumn DColumn C
9Column CColumn DColumn C
10Column CColumn DColumn C
11Column CColumn DColumn C
12Column CColumn DColumn C
13Column CColumn DColumn C
14Column CColumn DColumn C
15Column CColumn DColumn C
16Column CColumn DColumn C
17Column CColumn DColumn C
18Column CColumn DColumn C
19Column CColumn DColumn C
20Column CColumn DColumn C
21Column CColumn DColumn C
22Column CColumn DColumn C
23Column CColumn D
24
Items
Cell Formulas
RangeFormula
J3:J6999J3=FILTER(C4:D7000,C3:D3=Search!B2,"")&""
Dynamic array formulas.


Book1
AB
2Drop Down ->Item
3Column C
4Column C
5Column C
6Column C
7Column C
8Column C
9Column C
10Column C
11Column C
12Column C
13Column C
14Column C
15Column C
16Column C
17Column C
18Column C
19Column C
20Column C
21Column C
22Column C
23
Search
Cell Formulas
RangeFormula
B3:B6999B3=Items!J3#
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
B2List=Items!$C$3:$D$3
 
Upvote 0
I'm not quite sure either, but if this is your Items sheet:

Book2
ABCDEFG
1
2
3ListItemsDescriptionHeader4Header5Header6
4aabcrst31516
5bdeftuv81814
6cabcrst12199
7ddefabc17310
8eabctuv9211
9fdefrst15111
10gabctuv234
11hdeftuv92019
12
Items


Then you can do this on your Search sheet:

Book2
ABCHIJKLMN
1
2Search code
3tuvDescription2
4
5ListItemDescriptionHeader4Header5Header6
6bdeftuv81814
7eabctuv9211
8gabctuv234
9hdeftuv92019
10
Search
Cell Formulas
RangeFormula
J3J3=IF(I3="Item",1,2)
I6:N9I6=FILTER(Items!B4:G11,ISNUMBER(SEARCH(B3,INDEX(Items!C4:D11,0,J3)))*(B3<>""),"No results")
Dynamic array formulas.
[XD=c:548235]=FILTER(Items!B4:G11,ISNUMBER(SEARCH(B3,INDEX(Items!C4:D11,0,J3)))*(B3<>""),"No results")[/XD][/XR][/RANGE]

I'm assuming your drop-down is in I3, then the formula in J3 will be a 1 if the drop-down is Item, and a 2 if it's Description (or anything else). Then the FILTER formula will use the INDEX function with that value to choose the column to search.

If I understand you correctly, you could actually use the "Items!C4:C7000" text in your formula if you surround it with the INDIRECT function, but this way is better (non-volatile).
 
Upvote 0
Solution
Using the INDEX function worked, thank you so much for your help with this.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,951
Members
449,095
Latest member
nmaske

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