Hypha
Hypha

Reputation: 51

Using Cell Reference in Query formula - Google Sheets

I have the following Query formula populating for items next to "Fruits".

=QUERY(Sheet1!$A$2:$C,"SELECT B, C WHERE A = 'Fruits' ",1)

I'd like to substitute the "Fruits" text value with a reference to a specific cell, like A2.

That way if I change the value in A2 from "Fruits" to "Fruit", I don't need to update the QUERY Formula

Here's a link to a sample sheet.

Thanks for your help.

Upvotes: 2

Views: 6636

Answers (2)

Hypha
Hypha

Reputation: 51

I found the solution by playing around a bit. This is what worked:

=QUERY(Sheet1!$A$2:$C,"SELECT B, C WHERE A = '"&A2&"' ",1)

Upvotes: 3

Harun24hr
Harun24hr

Reputation: 36840

Use below formula-

=QUERY(Sheet1!$A$2:$C,"SELECT B, C WHERE A = '" & A2 & "'",1)

Upvotes: 4

Related Questions