Grouping Rows in Excel
Organizing the large data by combining the subcategory data is the process and it’s called “Grouping of Rows” in excel. When the number of items in line is not important then we can choose group rows that are not important but see the subtotal of those rows only. When the data rows are huge scrolling down and reading the report may lead to wrong understanding so the grouping of rows helps us to hide the unwanted numbers of rows.
The number of rows is also lengthy when the worksheet contains detailed information or data. As a report reader of the data, they don’t want to see lengthy rows; instead, they just want to see the detailed view, but at the same time, if they require any other detailed information, they need just a button to expand or collapse the view as required.
In this article, we will show you how to group rows in excel with expand/collapse to maximize the report viewing technique.
How to Group Rows in Excel with Expand/Collapse?
For example, look at the below data.
In the above data table, we have city and state-related sales and cost data, but when you look at the first two rows of the data, we have “California” state and the city is “Los Angeles,” but sales happened at different dates, so as a report reader everybody prefers to read what the state-wise sales and city-wise sales in a single column, so by grouping the rows we can create a single line summary view.
Follow the below steps to group rows in excel.
Step 1: First create a subtotal like the below one.
Step 2: Now select the first state rows (California City), excluding subtotals.
Step 3: Go to the DATA tab and chose the “Group” option.
Step 4: Click on the drop-down list in excel of “Group” and choose “Group” again.
Step 5: Now, it will ask you whether to group rows or columns. Since we are grouping “Rows,” choose rows and click on ok.
Step 6: The moment you click on “Ok,” you can see a joint line on the left-hand side.
Click on the “MINUS” icon and see the magic.
Now we could see only what is the total summary for the city “California,” again, if you want to see the detailed summary of the city, you can click on the “PLUS” icon to expand the view.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
Now again, select the city “Colorado” and click on the “Group” option.
Now it will group for the “Colorado” state.
Group by Using Shortcut Key
With a simple shortcut in excel, we can group selected rows or columns very easily. The shortcut key to quickly group the data is SHIFT + ALT + Right Arrow Key.
First, select the rows that need to be grouped.
Now press the shortcut key SHIFT + ALT + Right Arrow Key to group these rows.
In the above, we have seen how to group the data and how to group row with expand and collapse option by using PLUS & MINUS icons.
The only problem with the above method is we need to do this for each state individually, so this takes a lot of time when there are a lot of states that are there. What would be your reaction if I say you can group with just one click???
Amazing, isn’t it? By using the “Auto Outline,” we can automatically group the data.
Example #1 – Using Auto Outline
The first thing we need to do is to create subtotal rows.
Now place a cursor inside the data range. Under Group drop-down, we can see one more option other than “Group,” i.e., “Auto Outline.”
The moment you click on this “Auto Outline” option, it will group all the rows which are there above the subtotal row.
How cool is this??? Very cool, isn’t it??
Example #2 – Using Subtotals
If grouping the rows for the individual city is the one problem, then even before grouping rows, there is another problem, i.e., adding subtotal rows.
When hundreds of states are there, it is a tough task to create a subtotal row for each state separately, so we can use the “Subtotal” option to quickly create a subtotal for the selected column.
For example, we had the data like the below before creating subtotal.
Under the Data tab, we have an option called “Subtotal” right next to the “Group” option.
Click on this option by selecting any of the cells of the data range; it will show below option first up.
First, select the column that needs to have a subtotal; in this example, we need subtotal for “State,” so select the same from the drop-down list of “At each change in.”
Next, we need to select the function type since we are adding all the values to choose the “Sum” function in excel.
Now select the columns that need to be summed. We need the summary of “Sales & Cost” columns so choose the same. Click on “Ok.”
We will have quick subtotal rows.
Did you notice one special thing from the above image???
It has automatically grouped rows for us!!!!
Things to Remember here
- Grouping rows shortcut key is Shift + ALT + Right Arrow Key.
- Subtotal needs data should be sorted.
- Auto Outline groups all the rows above the subtotal row.
This has been a guide to group rows in excel. Here we discuss how to group rows in excel with expand/collapse using an auto outline and subtotal option with examples and a downloadable excel template. You may also look at these useful functions in excel –