-1

I have a query:

=query(test_data_set!A2:C;"SELECT A, B, C" & if(countblank(dash!C1:C6)=6;"";" WHERE " & textjoin(" OR "; true; dash!C1:C4)) & "ORDER BY B";0)

in C1:C4 there is a text
in C5:C6 there is 2 dates

so i need to add in query textjoin(" AND "; true; dash!C5:C6)

How can i do it?

the way i do it doesn't work: =query(test_data_set!A2:C;"SELECT A, B, C" & if(countblank(dash!C1:C6)=6;"";" WHERE " & textjoin(" OR "; true; dash!C1:C4) & textjoin(" AND "; true; dash!C5:C6)) & "ORDER BY B";0)

please help

TheMaster
  • 45,448
  • 6
  • 62
  • 85
  • Just ignore the `IF` statement and `TEXTJOIN ` for a moment. Write out the actual SQL statement that would apply if countblank(Dash!C1:C6) <>6. – Tedinoz Nov 17 '18 at 11:52

1 Answers1

0

that works

=IFERROR(query(test_data_set!A2:C;"SELECT A, B, C WHERE A IS NOT NULL" & if(countblank('Dazrin Copy of Dash'!C1:C6)=ROWS(C1:C6);"";" AND " &IF(COUNTBLANK(C1:C4)<>ROWS(C1:C4);"("& textjoin(" OR "; true; 'Dazrin Copy of Dash'!C1:C4)&")";) &IF(AND(COUNTBLANK(C1:C4)<>ROWS(C1:C4);COUNTBLANK(C5:C6)<>ROWS(C5:C6));" AND ";)& "("&textjoin(" AND "; true; 'Dazrin Copy of Dash'!C5:C6) & ")") & " ORDER BY B ASC";0);"No items found")