0

First time posting. I'm having difficulty with the syntax for a query I'm making in Google Sheets, the function is as follows:

=MAX(QUERY({'Fall Scoresheet'!$B$9:$V$2009;'Winter Scoresheet'!$B$9:$V$2009;'Spring Scoresheet'!$B$9:$V$2009},"Select Col10 where Col4 contains '"&$C42&"' and Col2 >= '"&Instructions!$O$21&"' and Col2 <= '"&Instructions!$O$22&"'",0))

Its returns a #N/A error stating that the "Query completed with an empty output".

I have tested and hard coding the references works; example below:

=MAX(QUERY({'Fall Scoresheet'!$B$9:$V$2009;'Winter Scoresheet'!$B$9:$V$2009;'Spring Scoresheet'!$B$9:$V$2009},"Select Col10 where Col4 contains '"&$C42&"' and Col2 >= 3 and Col2 <= 5",0))

I expect it to return the maximum value from multiple sheets based on the conditions in the function. Am I missing something simple? Any help appreciated.

2 Answers 2

0

Try skipping the apostrophe ' for the parts thats handling the numbers and see what happens. So this '"&Instructions!$O$21&"' becomes "&Instructions!$O$21&". Same goes for '"&Instructions!$O$22&"'as well. the string part '"&$C42&"' remains as is...

Sign up to request clarification or add additional context in comments.

2 Comments

That did it! You're the man! What's the reasoning behind dropping the apostrophe?
Your Col2number data-type is not the same as '"&Instructions!$O$21&"'plain text data-type (due to the usage of single quotes)
0

Because it's a number, you change the following sentence: and Col2 >= '"&Instructions!$O$21&"' and Col2 <= '"&Instructions!$O$22&"' to and Col2 >= "&Instructions!$O$21&" and Col2 <= "&Instructions!$O$22&"' (Note the removal of commas)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.