Jack
Jack

Reputation: 361

What is the syntax when including standard Google Sheets functions within the QUERY function?

I would like to reference a cell in a query lookup using the LARGE function in Google Sheets. I have tried variations on the code below without success:

=QUERY(C2:D49,"select C where D = "large(D2:D49,2)"")

This leads me to ask what the rule is for referencing cell values within queries using standard functions.

Upvotes: 1

Views: 47

Answers (2)

TheMaster
TheMaster

Reputation: 50689

The query string is a plain string. No special rules apply as long as the resulting string is a valid query. Standard rules that apply to strings in spreadsheets apply to query strings too. You're looking for string concatenation in this instance:

="Maximum number of players allowed: "&large(D2:D49,1)

=JOIN(" ", "Maximum number of players allowed:", large(D2:D49,1))

Upvotes: 0

player0
player0

Reputation: 1

the syntax would be:

=QUERY(C2:D49, "select C where D = "&LARGE(D2:D49, 2), 0)

Upvotes: 2

Related Questions