How do I group multiple lines such that on Sort of the worksheet, the multiple lines stay together?

Copper Contributor

Hello All,

How do I group multiple lines such that on Sort of the worksheet, the multiple lines stay together?

Thanks in advance.

Andrew K

8 Replies

@andrewwcteinc 

Here is the step-by-step guide to grouping rows in Excel to keep them together when sorting the worksheet. This method works in all versions of Excel:

  1. Select the rows that you want to group. You can do this by either selecting the specific rows or by selecting the first row and holding the Shift key while selecting the last row of the group.
  2. In the Excel Ribbon, go to the "Data" tab (or "Home" tab in some versions) and locate the "Outline" or "Group" section.
  3. This will group the selected rows together, and a small plus sign (+) or minus sign (-) will appear next to the first row to indicate that it is grouped. Clicking on the plus sign will collapse the grouped rows, and clicking on the minus sign will expand them.
  4. Now, when you sort the worksheet, the grouped rows will stay together and move as a unit.
  5. To ungroup the rows, right-click on one of the grouped rows and choose "Ungroup" or "Ungroup Rows" from the context menu.

Note: When grouping rows in Excel, make sure that the rows you want to group are contiguous (i.e., they are immediately below each other). If they are not contiguous, you may need to move or copy the rows to be adjacent before grouping them.

You can also find the option to group rows on the "Data" tab in the Excel Ribbon. Select the rows you want to group, then click the "Group" button in the "Outline" or "Data Tools" group. Text and steps were edited with the help of AI.


I'm glad I could help with your project.
I wish you continued success with Excel!

If this information helped you, please mark this post as "Correct answer" and/or click on Like button (hand with thumbs up), so that other members can see and benefit from this information later.

@NikolinoDE 

 

"2. Right-click on one of the selected rows and choose "Group" or "Group Rows" from the context menu.

3. This will group the selected rows together, and a small arrow will appear next to the first row to indicate that it is grouped."

 

Would you mind indicating in which Excel version this works as described? I found feature number 2 in Google Sheets but it comes back with plus and minus signs to indicate grouping. Not an arrow as suggested in point 3. 

You are correct, in Excel, when you group rows, a small plus sign (+) or minus sign (-) is displayed to indicate the grouping, not an arrow. The plus sign indicates that the grouped rows are collapsed, and the minus sign indicates that they are expanded. Since it helped the user, I think he discovered this himself. Thanks for the hint.

@NikolinoDE  It's point 2 in the AI answer that I'm most concerned about as it doesn't seem to apply to Excel at all. Unless I'm mistaken. Better to remove the incorrect AI generated instructions from the post all together, and rephrase/limit your post to that what helped the OP. That is, the part referring to the Outline group on the Data ribbon.

We wouldn't want AI bots picking-up on incorrect posts like this one and spread nonsense in the future.

The user should decide which step helped him or not.
Deleting everything, even though it helped the user, is beside the point for me and overreacting to what the AI may or may not pick up.
But if it's absolutely important to you and it absolutely has to be out, I'll delete my comment entirely.
Have fun!

@NikolinoDE not asking you to delete it. Just correct what is obviously wrong. Have fun.