Reputation: 51
the problem I am immediately trying to solve is filtering the results of a VLOOKUP.
This formula is working:
=ArrayFormula(IFERROR(vlookup($A$4:$A,importrange("1XYHLG4-BhVUxXObvjEiozI6i19H5Jum97g87uFS6sYs", "DO_NOT_USE!A2:H3000"),{2,3,4,5},false)))
but I want to auto filter the results. I found an answer on this post: Add Filter to Vlookup formula Google sheets
However, when I do that, it seems ignores the VLOOKUP part. My results are no longer matched to the correct index key in Col A.
=query(ArrayFormula(IFERROR(vlookup(A4:A,importrange("1XYHLG4-BhVUxXObvjEiozI6i19H5Jum97g87uFS6sYs", "DO_NOT_USE!A2:H3000"),{2,3,4,5},false))), "WHERE Col2='"&B2&"'", 1)
Additional context: The problem I was originally trying to solve for was linking dynamic and static data. I have a larger sheet that I have divided using a query so that each school (about 60 schools) is only allowed to see data that pertains to them. Unfortunately, they must be able to manually add info to that sheet (this data is eventually generated into yet another sheet and required). I started solving this problem because this entire process was always done entirely on paper before and all info was hand-entered.
I feel like I'm SO CLOSE to a solution but I'm not sure where I'm going wrong.
EDIT- Sample data:
Upvotes: 1
Views: 865
Reputation: 2699
You problem for not return result as per expectation is an issue of Vlookup multiple criteria
, due to query
will always filter all the data into a new table rather than try to create row by row matching
and return blank row if not found:
1.To solve your issue with simple formula, first you need to add Helper Column
in your source data:
=ARRAYFORMULA(B2:B13&" "&C2:C13)
2.The revised source data:
3.Next, to use Vlookup
with some modification (I didnot use importrange
here because I am refering within same table)
=ArrayFormula(IFERROR(vlookup($B$16:$B&" "&$G$15,$A$1:$I$13,{2,3,4,5},false)))
The final outcome
You can display the result using query
function without plain text ID also, so that it will only return specific column and when the school is equal to the cell value:
=QUERY(B1:I13, "select B,C,D,E,F where C = '"&G15&"'")
Upvotes: 1