Home > Software engineering >  multiple where clause value form different sheet
multiple where clause value form different sheet

Time:01-04

I am trying to run this query using 2 where clause with the value coming from a different sheet, which is giving an error

These work

=query(Expenses!A1:H, "select B,D,G,H where G=2023 and H="& VALUE(Data!D2))
=query(Expenses!A1:H, "select B,D,G,H where H="& VALUE(Data!D2))

This one does not and gives an error. What am I missing here

    =query(Expenses!A1:H, "select B,D,G,H where G="& VALUE(Data!D1)" and H="& VALUE(Data!D2))

Thank you.

CodePudding user response:

use:

=query(Expenses!A1:H, "select B,D,G,H where G="& VALUE(Data!D1)&" and H="& VALUE(Data!D2))

  • Related