CTID1993
CTID1993

Reputation: 5

How to combine Select, where and label functions in google sheets query

I'm trying to query a column and select cells that contain the word: pink. I want to give this new column a new name: Biz priority. Current formulas I've tried but getting errors for all of them:

  1. =QUERY(N:N,"SELECT N WHERE N CONTAINS 'pink', LABEL * 'Biz Priority'"),1

  2. =QUERY(N:N,"SELECT N LABEL N 'Biz Priority', WHERE N CONTAINS 'pink'"),1

  3. =QUERY(N:N,"SELECT N LABEL * 'Biz Priority', WHERE N CONTAINS 'pink'"),1

This works: =QUERY(N:N,"SELECT N WHERE N CONTAINS 'pink'"),1 but the column title is the same as another column which won't work for me. TIA

Upvotes: 0

Views: 566

Answers (1)

Aresvik
Aresvik

Reputation: 4620

On:

=QUERY(N:N,"SELECT N WHERE N CONTAINS 'pink', LABEL * 'Biz Priority'"),1

Remove the comma before LABEL, change * to N, move the ) to the end.

=QUERY(N:N,"SELECT N WHERE N CONTAINS 'pink' LABEL N 'Biz Priority' ",1)

You can also make it case-insensistive:

=QUERY(N:N,"SELECT N WHERE LOWER(N) CONTAINS 'pink' LABEL N 'Biz Priority' ",1)

Upvotes: 1

Related Questions