Sejal Pachisia
Sejal Pachisia

Reputation: 1

Google Sheets: How do I get unique values for a column, based on a conditions in different columns?

Let's say I have three columns. Column A has a list of names (that are repeated), column B has the city they live in, and column C has the number of pets.

I can use the unique(A1:A5000) function to get the list of unique names. However, I want a list of the unique names for people who live in New York and have Zero pets.

I can use: COUNTUNIQUE(FILTER(A1:A5000,B1:B5000 = "New York",C1:C5000=0))

To get the number of unique people who live in new york and have zero pets, but I want to get a list of unique names.

Basically I want to combine the "unique" and "if" features and I'm not sure how to do that.

I would be open to doing this in two steps: Step 1: Get a column with all the names of people who satisfy this condition Step 2: Get the unique names in that column. But I'm not sure how to do step 1.

Upvotes: 0

Views: 2301

Answers (1)

pnuts
pnuts

Reputation: 59485

Please try:

=query(A:C,"Select A where B contains 'New York' and C=0")

Upvotes: 0

Related Questions