Can i add three diferent rules to a query function?

Viewed 17

I have two different QUERY functions, one is using two different rules, and the other uses only one. Is there a way to merge the two?

The first one uses a validation list of names to generate the results:

=QUERY('Respostas Formulário'!A:L;
 "where A >= date '"&TEXTO(E2; "yyyy-mm-dd")&"' 
    and A <= date '"&TEXTO(F2; "yyyy-mm-dd")&"'"&
 IF(B2="Todos os Mestres";;" and B = '"&B2&"'"); 1)

The second one uses another validation list to generate a similar result:

=QUERY('Respostas Formulário'!A:L;
 "where A >= date '"&TEXTO(E2; "yyyy-mm-dd")&"' 
    and A <= date '"&TEXTO(F2; "yyyy-mm-dd")&"'"&
 IF(C2="Todas as Tasks";;" and D = '"&C2&"'"); 1)
  • Is there any way to use both the date, the info in B2, and the info in C2 to generate a query?
1 Answers

try:

=QUERY('Respostas Formulário'!A:L;
 "where A >= date '"&TEXTO(E2; "yyyy-mm-dd")&"' 
    and A <= date '"&TEXTO(F2; "yyyy-mm-dd")&"'"&
 IF(B2="Todos os Mestres";;" and B = '"&B2&"'")&
 IF(C2="Todas as Tasks";;  " and D = '"&C2&"'"); 1)
Related