1
votes

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.

2

2 Answers

2
votes

the syntax would be:

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

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))