google-sheetsgoogle-sheets-formula

How can I make this formula more dynamic by including another criteria (cell F11) in the query?


This formula currently queries data based on a criteria. How can I include another criteria, which will result in a subset of the filtered by either both (C11 and F11) or one of them.

=if(C11<>"";
QUERY(Dados!A1:V;"select A, B, E, L, ' ', M, N, O, G, F, P, Q, R, T, I, J where H matches '"&C11&"'");
QUERY(Dados!A1:V;"select A, B, E, L, ' ', M, N, O, G, F, P, Q, R, T, I, J where A is not null label ' ' ' '"))

I guess it would be map based, but that is too new to me.

Here is the data and the expected result in the green background table:

enter image description here

...and here is the file, in case you feel like giving it a shot.


Solution

  • You have sales data including "Product", "Company" and "Lota" (Load) and you want to query the data based on any combination of "Product" and/or "Company" and/or "Lote".

    Consider this answer (applying an idea expressed by @MikeSteelson in How to use query to filter data based on certain conditions in google sheet).


    Search Results - one criteria

    Search Results


    Search Results - two criteria

    two criteria


    Master List - Validation Rules

    Validation Rules