The keyboard shortcut Alt+D+O in Excel opens the Group dialog box, which lets you group selected rows or columns so you can collapse and expand them with the +/- buttons in the margin. This is the fastest way to organize large sheets, hide detail temporarily, or create outline levels. You don't need any special setup—just select the rows or columns you want to group, press the keys in sequence (not all at once), and choose Rows or Columns in the dialog. If you're on a Mac, the shortcut is Cmd+Shift+K (or Option+Shift+Right Arrow in some versions), but the steps below focus on Windows Excel, which is where Alt+D+O works. Note that menu labels and dialog wording can vary slightly by Excel version (2016, 2019, 365), but the core steps are the same.

What You'll Need

  • Microsoft Excel for Windows (any recent version).
  • A worksheet with data you want to group—rows or columns that share a logical category (e.g., monthly totals under quarterly headings).
  • Your keyboard (the shortcut doesn't work with the on-screen touch keyboard).

Step-by-Step

  1. Select the rows or columns you want to group. Click and drag across the row numbers (on the left) or column letters (on top). For example, to group rows 2 through 5, click row 2's number, hold the mouse button, drag down to row 5, and release. You can also hold Ctrl to select multiple non-adjacent ranges, but grouping works best on a contiguous range.
  2. Press the keys in sequence: Alt, then D, then O. Do not press them all at once—press and release Alt, then press and release D, then press and release O. You'll see the Group dialog box appear. (If you press them simultaneously, Excel may interpret it as a different command.)
  3. In the Group dialog, choose “Rows” or “Columns”. The dialog has two radio buttons: “Rows” and “Columns”. Select the one that matches what you selected in step 1. If you selected rows, pick “Rows”; if columns, pick “Columns”. Then click OK.
  4. Check the grouping indicators. After you click OK, you'll see a bracket-like line on the left (for rows) or on top (for columns) with a minus sign (-). Click that minus sign to collapse the group; it turns into a plus sign (+), which you click to expand again.
  5. To group multiple levels, repeat the process. For example, you might group rows 2-5 as one group, then group rows 2-10 as a larger group. Excel supports up to 8 levels of nesting. Just select the larger range and press Alt+D+O again, choosing the same type.
  6. To ungroup, use Alt+D+U. Select the grouped rows or columns, press Alt, then D, then U (or use the Ribbon: Data > Outline > Ungroup). This removes the grouping but does not delete any data.

Common Mistakes

  • Pressing all three keys at once. Alt+D+O is a sequence, not a chord. If you press them together, Excel might open the Data tab or do nothing. Practice the rhythm: Alt, D, O.
  • Selecting the wrong range. If you select entire rows by clicking the row numbers, that's fine. But if you select cells within the rows (e.g., A2:C5) and then press Alt+D+O, Excel may ask if you want to group by rows or columns based on the selection—and it might group the wrong dimension. Always select the entire rows or columns (by their headers) to avoid confusion.
  • Grouping hidden rows. If some rows in your selection are already hidden (filtered or manually hidden), grouping can behave unpredictably. Unhide everything first (select all rows, then right-click > Unhide) before grouping.
  • Forgetting to choose Rows vs. Columns in the dialog. The dialog defaults to whatever Excel guesses, which may not be what you want. Always double-check the radio button before clicking OK.

Tips

  • Use the Ribbon alternative. If you prefer the mouse, go to Data > Outline > Group (or Data > Group in newer versions). The keyboard shortcut is faster once you're used to it.
  • Group with Auto Outline. If your data has formulas that reference subtotals (e.g., SUM functions), you can let Excel create groups automatically: select the data, then press Alt+D+G (or Data > Outline > Group > Auto Outline). This is great for financial reports.
  • Collapse/expand all quickly. Press Alt+D+E (or Data > Outline > Show Detail) to expand the selected group, and Alt+D+H (or Hide Detail) to collapse it. Or use the numbers 1,2,3 at the top-left of the outline area to show all levels at once.
  • Group without dialog. If you don't want to see the dialog, you can use Shift+Alt+Right Arrow (Windows) to group rows, and Shift+Alt+Left Arrow to ungroup. This skips the dialog and uses Excel's default (rows) or the last used setting.
  • Clear all groups at once. Select the entire sheet (Ctrl+A twice) and press Alt+D+U to ungroup everything. Be careful—this removes all grouping, but it doesn't delete data.

Troubleshooting

If Alt+D+O doesn't work as expected, try these in order:

  1. Check your keyboard layout. If you're using a non-US keyboard, the D and O keys might be in different positions. The shortcut uses the physical keys, not the letters' labels, so it should still work, but if your keyboard has a different layout (e.g., AZERTY), the keys may be swapped. Try using the Ribbon instead.
  2. Make sure you're not in cell edit mode. If you're typing in a cell (the cursor is blinking), Alt+D+O will just type characters. Press Esc to exit edit mode, then try again.
  3. Check if the Outline feature is disabled. Go to File > Options > Advanced, scroll to the “Display options for this worksheet” section, and ensure “Show outline symbols if an outline is applied” is checked. If it's unchecked, grouping still works but the +/- buttons won't show, making it look like nothing happened.
  4. Try the Ribbon method. If the keyboard shortcut fails, go to Data > Outline > Group. If that works, the shortcut might be blocked by an add-in or a custom keyboard assignment. You can reset shortcuts in File > Options > Customize Ribbon > Keyboard shortcuts: Customize, but that's advanced.
  5. Restart Excel. Sometimes a temporary glitch prevents shortcuts. Save your work, close Excel, reopen, and try again.
  6. Check for merged cells. If your selection includes merged cells, grouping may fail or produce unexpected results. Unmerge any merged cells in the range before grouping.

Frequently Asked Questions

Does Alt+D+O work on Excel for Mac?

No, Alt+D+O is Windows-only. On Mac, use Cmd+Shift+K to group rows, or Cmd+Shift+J to group columns (in Excel 2016 and later). Alternatively, go to the Data tab and click Group.

Can I group non-adjacent rows with Alt+D+O?

Yes, you can select multiple ranges by holding Ctrl while clicking row numbers, then press Alt+D+O. Excel will group each range separately. However, if the ranges are separated by hidden rows, it may not work as expected—unhide first.

What's the difference between grouping and hiding rows?

Grouping creates a collapsible outline that you can toggle with a click. Hiding rows (right-click > Hide) simply removes them from view, and you have to use the Go To feature or unhide manually. Grouping is more user-friendly for reports because it keeps the structure visible.

Why do my grouped rows not show the plus/minus buttons?

This usually happens when the outline symbols are hidden. Go to File > Options > Advanced, under “Display options for this worksheet,” check “Show outline symbols if an outline is applied.” Also make sure the worksheet isn't in Page Layout view—switch to Normal view.

Can I group columns as well as rows?

Yes, just select column letters (e.g., B through D) and press Alt+D+O, then choose “Columns” in the dialog. The outline symbols appear at the top of the column headers.

How do I remove grouping without deleting data?

Select the grouped rows or columns, press Alt+D+U (or Data > Ungroup), and choose “Rows” or “Columns” if prompted. This ungroups them but leaves all data intact. To remove all grouping at once, select the entire sheet (Ctrl+A twice) and press Alt+D+U.