Using the FILTER function on a result returned by the FILTER function.

Herakles

Well-known Member
Joined
Jul 5, 2020
Messages
927
Office Version
  1. 365
Platform
  1. Windows
Following in from my previous post here, how do I apply a filter to the results of the filter and subsequently populate the array.

This code returns rows 2 to 9 from table tblNames, I now want to filter those rows that have a value of 'Item 3' in the first column.

Thanks.

test.xlsm
ABC
1NameGroupWins
2PeterC1
3Item 2A6
4Item 3C4
5Item 3C5
6Item 3A7
7Item 6A9
8Item 7C3
9Item 8A7
10HelenB4
11Item 10C6
12Item 3B3
13Item 3B5
14Item 11B7
Names


VBA Code:
Private Sub testIt()
Dim arr As Variant

arr = Evaluate("IFERROR(chooserows(FILTER(tblNames,tblNames[Group]<>""""), SEQUENCE(9,1,2,1)), """")")

End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
You could use something like:

Code:
"LET(a,IFERROR(CHOOSEROWS(FILTER(tblNames,tblNames[Group]<>""""), SEQUENCE(9,1,2,1)), """"),FILTER(a,INDEX(a,0,1)=""item 3""))
 
Upvote 0
I thought it might be safer to do the Iferror last.
VBA Code:
Private Sub testIt()
Dim arr As Variant

arr = Evaluate("IFERROR(LET(fltr,CHOOSEROWS(FILTER(tblNames,tblNames[Group]<>""""),SEQUENCE(9,1,2,1)),FILTER(fltr,CHOOSECOLS(fltr,1)=""Item 3"")), """")")

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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