Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

Google Sheets Query using important range and a dynamic cell reference

I have a roster of students (Sheet 1) and I need a formula to search another sheet (Sheet 2) to see if each student on Sheet 1 is also on Sheet 2 and if they return the word "yes"/ if they are not I would like the cell to remain blank.

This is the formula I have: =QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1395p5J5oN4vYLPeyAdUQDZluwxWU53NYJPiqeHdXSEw/", "Quarter 3!A3:H"), "Select 'yes' where Col1="&$A7&"")

The formula is not working properly.

For students that are on Sheet 2 the formula is returning two rows of data (two rows of "yes) and the first instance of "yes" include characters that I did not include in the query: enter image description here

For students not on Sheet 2, the formula is returning a yes with the extra characters "yes"().

I feel like I should be using an IF function, but I could not get it to work with IMPORTRANGE

question from:https://stackoverflow.com/questions/65837051/google-sheets-query-using-important-range-and-a-dynamic-cell-reference

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

use:

=QUERY(IMPORTRANGE(
 "1395p5J5oN4vYLPeyAdUQDZluwxWU53NYJPiqeHdXSEw", "Quarter 3!A3:H"), 
 "select 'yes' where Col1="&$A7&"
  label 'yes''')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...