samedi 9 juillet 2016

Google Sheet query where B = X only if B is not empty

I would like to make a query to filter some information in my table depending on different fields I can choose from a drop down. (D1, D2, D3, D4).

This query below works, but only if I specify 4 criteria. I would like to have a query only on D1 and D2 criteria if I leave D3 and D4 empty.

=QUERY(Data!A2:S; 
"select * 
where B = '"&D1&"'    >> only if D1 not empty
and C = '"&D2&"'      >> only if D2 not empty
and G = '"&D3&"'      >> only if D3 not empty
and I = '"&D4&"'      >> only if D4 not empty
" )

Aucun commentaire:

Enregistrer un commentaire