edanish
edanish

Reputation: 37

How to return multiple values in a single row based on the criteria in Google Sheet

I have two columns “Fruits” and “Color”, I intend to first filter the color and return the multiple values in a single cell based on the filtered unique color. I am using Google Sheet; I hope it is possible with it.

enter image description here

Upvotes: 0

Views: 2102

Answers (1)

Wicket
Wicket

Reputation: 38425

It's possible and there are several ways to do this. One of them is to use QUERY and JOIN built-in functions. Assume that the Fruit and Color columns are Columns A and B respectively, the following formula will return Apple | Cherry | Tomato :

=JOIN(" | ",QUERY(A:B,"SELECT A WHERE B = 'Red'",1)

'Red' is a literal. If you want to replace it by the C2 value, then use the following

=JOIN(" | ",QUERY(A:B,"SELECT A WHERE B = '"&C2&"'",1))

Upvotes: 1

Related Questions