0

I'm trying to write an intersection query in Google Sheets that lists all the rows in sheet 1 that contain a cell in sheet 1, column A, that matches at least one cell in sheet 2, column P

This is the first time I've tried writing a more advanced formula on Google Sheets, using a combination of Sheets functions and the Google Visualization API Query Language. I'm just starting to learn the syntax and everything and I'm sure I'm messing things up so I hope someone can point out what I'm doing wrong. My current query is:

=QUERY('Sheet1'!A1:T, "SELECT * WHERE (VLOOKUP(A, 'Sheet2'!P, 1, FALSE) IS NOT NULL)", 1)
  • What output are you getting? What output are you expecting? – ale Oct 5 '18 at 20:27
  • (VLOOKUP(A, 'Sheet2'!P, 1, FALSE) is not a valid Google Query clause. As a Google Sheets formula it has reference errors as A and 'Sheet2'!P aren't valid references. – Rubén Oct 5 '18 at 20:30
  • I'm getting an error, likely due to the issues Rubén stated. I'm expecting (hoping for...) a subset of rows from sheet 1 that have a column A cell value in common with a column P cell from sheet 2. – Michael Oct 5 '18 at 22:09
0

Michael, try this for your QUERY():

=ArrayFormula(QUERY({IF(NOT(ISERROR(VLOOKUP(Sheet1!A:A,Sheet2!P:P,1,FALSE))),Sheet1!A:T,"")}, "Select * Where Not Col1 = ''"))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.