How to group columns in Excel

The tutorial looks at how to group columns in Excel manually and use the Auto Outline feature to group columns automatically.

If you feel overwhelmed or confused about the extensive content of your worksheet, you can organize columns in groups to easily hide and show different parts of your sheet, so that only the relevant information is visible.

How to group columns in Excel

When grouping columns in Excel, it's best to do this manually because the Auto Outline feature often delivers controversial results.

Note. To avoid incorrect grouping, make sure your worksheet does not have any hidden columns.

To group columns in Excel, perform these steps:

  1. Select the columns you want to group, or at least one cell in each column.
  2. On the Data tab, in the Outline group, click the Group button. Or use the Shift + Alt + Right Arrow shortcut.
  3. If you've selected cells rather than entire columns, the Group dialog box will appear asking you to specify exactly what you want grouped. Obviously, you choose Columns and click OK.
    Group columns

To see how it works in practice, let's group all the intermediate columns in the below dataset. For this, we highlight columns B through I, and click Group:
Grouping columns in Excel

This creates the level 1 outline like shown below:
Column group

Clicking the minus (-) sign at the top of the group or the outline number 1 in the upper-left corner hides all the columns within the group:
A column group is hidden.

Create nested column groups

Within any group, you can outline multiple groups at inner levels. To create an inner, nested group of columns, this is what you need to do:

  1. Select the columns to be included in the inner group.
  2. On the Data tab, in the Outline group, click Group. Or press the Shift + Alt + Right Arrow shortcut.

In our dataset, to group the Q1 details, we select columns B through D and click Group:
Creating a nested column groups

In the same fashion, you can group Q2 details (columns F through H).

Note. As only adjacent columns can be grouped, you will have to repeat the above steps for each inner group individually.

As the result, we now have 2 levels of grouping:

  • Outer group (level 1) - columns B through I
  • Two inner groups (level 2) - columns B - D and F - H.

Multiple levels of column grouping

Clicking the minus (-) button above the inner group contracts only that particular group. Clicking the number 2 in the upper-left corner collapses all the groups of this level:
The inner column groups are collapsed.

To make the hidden data visible again, expand the column group by clicking the plus (+) button. Or you can expand all the groups at a given level by clicking the outline number.

Tips and notes:

  • To quickly hide or show the outline bars and numbers, press the Ctrl + 8 keys together. Pressing the shortcut for the first time hides the outline symbols, pressing it again redisplays the outline.
  • If the outline symbols don't show up in your Excel, make sure the Show outline symbols if an outlineis applied check box is selected in your settings: File tab > Options > Advanced category.

How to auto outline columns in Excel

Microsoft Excel can also create an outline of columns automatically. This works with the following caveats:

  • There should be no blank columns in your dataset. If there are any, remove them as described in this guide.
  • To the right of each group of detail columns, there should be a summary column with formulas.

In our dataset, there are 3 summary columns like show below:
Summary columns

To auto outline columns in Excel, do the following:

  1. Select the dataset or any single cell within it.
  2. On the Data tab, click the arrow below Group, and then click Auto Outline.
    Creating an outline automatically

In our case, the Auto Outline feature created two groups for Q1 and Q2 data. If you also want an outer group for columns B - I, you'll have to create it manually as explained in the first part of this tutorial.
Outlined columns

If your summary columns are placed to the left of the detail columns, proceed in this way:

  1. Click a small arrow in the lower-right corner of the Outline group, which is called the dialog box launcher.
    Click the dialog box launcher.

  2. In the Settings dialog box that pops up, clear the Summary columns to right of detail box, and click OK.
    Summary columns to right of detail

After that, use the Auto Outline feature as explained above, and you will get the following result:
Auto outlined columns

How to hide and show grouped columns

Depending on how many groups you want to cover up or display, use one of the below techniques.

Hide and show a particular column group

  • To hide the data within a certain group, click the minus (-) sign for the group.
  • To show the data within a certain group, click the plus (+) sign for the group.

Expand or collapse the whole outline to a given level

To hide or show the entire outline to a certain level, click the corresponding outline number.

For example, if your outline has three levels, you can hide all the groups of the second level by clicking the number 2. To expand all the groups, click the number 3.

Hide and show all of the grouped data

  • To hide all the groups, click the number 1. This will display the lowest level of detail.
  • To display all the data, click the highest outline number. For example, if you have four levels, click the number 4.

Our sample dataset has 3 outline levels:

Level 1 - only shows Items and Grand Total (columns A and J) while hiding all intermediate columns.

Level 2 – in addition to level 1, also displays Q1 and Q2 totals (columns E and I).

Level 3 - shows all the data.
3 outline levels

How to copy only visible columns

After hiding some column groups, you may want to copy the displayed data somewhere else. The problem is that highlighting the outlined data in the usual way selects all the data, including the hidden columns.

To select and copy only visible columns, this is what you need to do:

  1. Use the outline symbols to hide the columns that you don't want copied.
  2. Select the visible columns using the mouse.
  3. On the Home tab, in the Editing group, click Find & Select > Go To.
  4. In the Go To Special dialog box, select Visible cells only, and click OK.
    Select visible cells only.

  5. Now that you have only the visible cells selected, press Ctrl + C to copy them.
  6. Click the destination cell and press Ctrl + V to paste the copied data.

How to ungroup columns in Excel

Microsoft Excel provides an option to remove all groupings at once or ungroup certain columns only.

How to remove the entire outline

To remove all groupings at a time, go to the Data tab > Outline group, click the arrow under Ungroup, and then click Clear Outline.
Clear Outline

Notes:

  • Clearing outline only removes the outline symbols; it does not delete any data.
  • If some column groups were collapsed while clearing outline, those columns might remain hidden after the outline is removed. To display the data, undie columns manually.
  • Once the outline is cleared, it's not possible to get it back with Undo. You will have to recreate the outline from scratch.

How to ungroup specific columns

To remove grouping for certain columns without removing the entire outline, these are the steps to perform:

  1. Select the rows you want to ungroup. For this, you can hold down the Shift key while clicking the plus (+) or minus (-) button for the group.
  2. On the Data tab, in the Outline group, and click the Ungroup button. Or press the Shift + Alt + Left Arrow keys together, which is the ungrouping shortcut in Excel.
    Ungrouping specific columns

That's how to group and auto outline columns in Excel. I thank you for reading and hope to see you on our blog next week.

9 comments

  1. Is there any way you can create a groups right next to each other, an example is from column B-H and I-K.

    I have tried but it keeps merging the groups.

    • I'm having the same issue!!! and can't figure it out for the life of me

      • I was trying the same for almost a day and found that an empty column inbetween the actual columns allows to create adjacent groups for columns, for example group A-D, leave E as blank and group F-I, leave J blank and group the columns after that. It works.

  2. How would I group sets of columns, that are adjacent to each other? I wish to group columns in sets of four i.e., A-D, E-H, I-J and M-P. However if i group A-D and then E-H, all columns from A-H get grouped as one group.

    What am I doing wrong here?

      • Hi Alexander!
        Thanks, I tried this too, but the maximum nested column groups is 8, and I need more; at least 12.

        As this solution will not work for me, is there a way I could add a button and if the user clicks it, it hides a set of columns and if clicked again, it unhides the set?

        I don't mind if I have to use a macro for this.

  3. How to group week wise in a pivot table

  4. In XLXS I have a column with a list of names in alphabetical order. In other columns I have lists of times for events associated with these names. How do I create a column, adjacent to a column of times, that shows the placing i.e. 1st, 2nd, 3rd (or 1,2,3) all the way to the last person. Not all names are in every event. I don't want to sort the sheet as that would change the list of names.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)