Reputation: 854
I am trying to make the formula bellow work as follows: Get the values on A when B matches the values on E (for the sample it would be 1,2,4,5,7,8).
=QUERY({IMPORTRANGE("1Cg9gx2IhBUYwElNXprNJnihixbMLJcK1DKzIClQDNwc";"DATA!A2:C")};"select Col1 Where Col3 >= date '"&TEXT(TODAY;"yyyy-mm-dd")&"'and Col3 <= date '"&TEXT(TODAY;"yyyy-mm-dd")&"'and Col2="&(E1:E2)&"";0)
sample data:
A B C E
1 X 27/02/2019 X
2 Y 27/02/2019 Y
3 Z 27/02/2019
4 X 27/02/2019
5 Y 27/02/2019
6 Z 27/02/2019
7 X 27/02/2019
8 Y 27/02/2019
How can I accomplish that?
Upvotes: 1
Views: 406
Reputation: 1
QUERY
can't handle array/range inside quoted partTODAY
needs to be with ()
like TODAY()
=QUERY(IMPORTRANGE("1Cg9gx2IhBUYwElNXprNJnihixbMLJcK1DKzIClQDNwc"; "DATA!A2:C");
"select Col1
where Col3 >= date '"&TEXT(TODAY(); "yyyy-MM-dd")&"'
and Col3 <= date '"&TEXT(TODAY(); "yyyy-MM-dd")&"'
and (Col2 = '"&E1&"'
or Col2 = '"&E2&"')"; 0)
or try like this if you have array/range of values:
=QUERY(FILTER(IMPORTRANGE("1Cg9gx2IhBUYwElNXprNJnihixbMLJcK1DKzIClQDNwc"; "DATA!A2:C100");
COUNTIF(E1:E100; "="&
IMPORTRANGE("1Cg9gx2IhBUYwElNXprNJnihixbMLJcK1DKzIClQDNwc"; "DATA!B2:B100")));
"select Col1
where Col3 >= date '"&TEXT(TODAY(); "yyyy-MM-dd")&"'
and Col3 <= date '"&TEXT(TODAY(); "yyyy-MM-dd")&"'"; 0)
Upvotes: 0