A | B | C | D |
---|---|---|---|
1 | pen | red | 500 |
2 | pen | blue | -50 |
3 | pen | red | 0 |
4 | pencil | blue | 17 |
5 | pencil | green | -1.5 |
To only return "pencil" data:
=QUERY("A1:D6","select * where B='pencil' ",1)
To only return rows that contain "pen" (all rows):
=QUERY("A1:D6","select * where B contains 'pen' ",1)
To only return rows where the price is greater than 0:
=QUERY("A1:D6","select * where D>0 ",1)
Note that text strings require apostrophes while numerical values do not.