I have this formula that works fine:
query('SG_69.00 USD Reward'!$A$1:$AM,"
select
A,' ',D,W,O,P,Q,R,S,T,V,' ',' ',AK
where
AM ='US'
label ' ''', ' ''', ' '''
",0)
However in that instance I only have one condition for the where clause.
I have use for doing a long series of OR conditions as in AM='US' OR AM='NZ'
and so on. All comparing to the AM column.
I could do it with a long series of OR conditions as I mentioned above. But what I would like to have where AM='named range'
(or just a range) of the various or a solution to that effect.
Thanks.
Edit I tried Max' solution below. However I didn't think to add what complicates my situation further. As I'm creating an array with several query functions combined like this:
={query('SG_39.00 USD Reward'!$A$1:$AM,"
select
A,' ',D,W,O,P,Q,R,S,T,V,' ',' ',AK
where
AM = '" & join("' or AM = '", ASIA) & "'
label ' ''', ' ''', ' '''
",0);query('SG_69.00 USD Reward'!$A$1:$AM,"
select
A,' ',D,W,O,P,Q,R,S,T,V,' ',' ',AK
where
AM = '" & join("' or AM = '", ASIA) & "'
label ' ''', ' ''', ' '''
",0);query('SG_179.00 USD Reward'!$A$1:$AM,"
select
A,' ',D,W,O,P,Q,R,S,T,V,' ',' ',AK
where
AM = '" & join("' or AM = '", ASIA) & "'
label ' ''', ' ''', ' '''
",0);query('SG_1_000.00 USD Reward'!$A$1:$AM,"
select
A,' ',D,W,O,P,Q,R,S,T,V,' ',' ',AK
where
AM = '" & join("' or AM = '", ASIA) & "'
label ' ''', ' ''', ' '''
",0);query('SG_Celery - Fulfillment.csv'!$A$1:$AV,"
select
B,' ',S,V,Y,AA,AB,AC,AD,AE,AF,' ',' ',AT
where
AV ='US'
label ' ''', ' ''', ' '''
",0)}
I get a value error when I try to call that.
Apparently combining it in this way doesn't work. I didn't think that that was what was causing the error. Can you think of a way around this?
You may make the or conditions with help of join
function:
=join("' or AM = '", named_range)
Here is sample query text formula:
="select A, B where A = '"&join("' or A = '",D1:D4) & "'"
Note
The formula has manually entered where A = '
before join
and closing quote & "'"
after.