Perdixo
Perdixo

Reputation: 1289

Regrouping rows containing the same column content

I have a file containing multiple rows and columns (Name, Avatar, Company). I'd like the rows having similar content in the company column to be regrouped in my file. Here is a visual example of what i have :

Name     |Avatar      |Company
-------------------------------
ZZZ      |MMM         |MMM
XXX      |PPP         |AAA
UUU      |QQQ         |MMM
YYY      |OOO         |AAA

And what i'd like to do :

Name     |Avatar      |Company
-------------------------------
XXX      |PPP         |AAA
YYY      |OOO         |AAA

Name     |Avatar      |Company
-------------------------------
ZZZ      |MMM         |MMM
UUU      |QQQ         |MMM

How can i achieve this in Google Sheets?

Upvotes: 1

Views: 72

Answers (1)

marikamitsos
marikamitsos

Reputation: 10573

You can use the following formula

={QUERY(A2:C6,"where C='AAA'",1);
QUERY(A2:C6,"where C='MMM'",1)}

enter image description here

OR you can take advantage of the skipping clause

={QUERY(A2:C6,"skipping 2");
QUERY({A2:C2;A2:C6},"skipping 2")}

enter image description here

Functions used:

Upvotes: 1

Related Questions