Search code examples
arraysgoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

QUERY with double condition in Google Sheets


I have a table similar to this

A     B     C     D     E
a1    b1    5     d1   
a2    b2    5     d2
a3    b1    3           e1
a4    b3    4           e2
a5    b1    5     d3    e3

I'm trying to figure out a query that shows A,B,C,D if the value in D is not empty

SELECT A,B,C,D WHERE D is not null

Also, if the value in the C column is lower or equal to 3 I need it to show the values in column E, even if D is empty.


Solution

  • try:

    =QUERY(A2:E, "where D is not null or C <= 3", 0)
    

    enter image description here