Search code examples
google-sheetsgoogle-query-language

Query Filter Results


I am trying to query and then filter my results based on the drop down in N4

=
IF(and(N4="ALL"), query(Vendors!1:1000,"select A, B, C, D, E, F, G, H, I, J, K, L", 2),

IF(and(N4="Trained"), query(Vendors!1:1000,"select A, B, C, D, E, F, G, H, I, J, K, L", 2),
IF(and(N4="Requested"), query(Vendors!1:1000,"select A, B, C, D, E, F, G, H, I, J, K, L", 2),
IF(and(N4="Invited"), query(Vendors!1:1000,"select A, B, C, D, E, F, G, H, I, J, K, L", 2)))))

Those all return results. However, now I need help omitting the results that dont match the dropdown.


Solution

  • Sorry I didn't read it correctly. Try this.

    =IF (N4 <>"ALL",IF(OR(OR( N4="Trained",N4="Requested",N4="Invited")),query(Vendors!1:1000,"select A, B, C, D, E, F, G, H, I, J, K, L where A = '"& N4 &"'")),query(Vendors!2:1000,"select A, B, C, D, E, F, G, H, I, J, K, L where A<>''")) 
    

    Key in the Header row. Change Column A to whatever column "Trained", "Invited", etc are in.