Returning entire rows from multiple sheets into array based on lookup values in multiple columns

bdorofey

New Member
Joined
Jan 2, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. Web
I am attempting to utilize the VSTACK and FILTER functions to return entire rows of data from multiple tabs into a single array based on names populated in either of two specific columns (D & E) on each tab; the result returns an error. The VSTACK function alone returns a stacked array, so I figure that the error is on the FILTER side. I’ve tried the following equation:

=LET(v,VSTACK(SchoolA!A1:I300,SchoolB!A1:I300,SchoolC!A1:I300),((FILTER(v,INDEX(v,,A1:A300)<>""))*(FILTER(v,INDEX(v,,D1:E300)=B1))))

Where:
Blank lines are to be removed by checking Column A
Lookup values are to be found by checking Columns D and E
Lookup value is located in Cell B1
Any help is greatly appreciated.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Once you've combined the three arrays with VSTACK, they do not have a column A,B,C,... designation. You can refer to individual columns using INDEX, but the row and column arguments must be numbers (or arrays of numbers), not range references. Also note that VSTACK is producing a 900 row array (not a 300 row array).
So, if you want the 1st column to exclude blanks AND you want both the 4th and 5th columns to each equal B1, then...
Excel Formula:
=LET(v,VSTACK(SchoolA!A1:I300,SchoolB!A1:I300,SchoolC!A1:I300),FILTER(v,(INDEX(v,,1)<>"")*(INDEX(v,,4)=B1)*(INDEX(v,,5)=B1)))
And if you want the 1st column to exclude blanks AND you want either the 4th OR 5th column (or both) to equal B1, then...
Excel Formula:
=LET(v,VSTACK(SchoolA!A1:I300,SchoolB!A1:I300,SchoolC!A1:I300),FILTER(v,(INDEX(v,,1)<>"")*(((INDEX(v,,4)=B1)+(INDEX(v,,5)=B1))>0)))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,073
Messages
6,122,974
Members
449,095
Latest member
Mr Hughes

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