Pressing Alt, then D, then F, then S in Excel opens the Sort dialog box. The sequence is a legacy keyboard shortcut that works by pressing Alt once to reveal the Key Tips (the little letters that appear over the ribbon tabs), then pressing D for the Data tab, F for the Sort & Filter group, and S for Sort. It runs on Windows desktop Excel. Excel for Mac and Excel for the web do not use Key Tips in the same way, so the same four keys do nothing there — Mac users reach Sort through the Data menu or their own menu shortcuts. The keystrokes are pressed one after another, not held together like Ctrl+C.
What You'll Need
- Excel for Windows, desktop version (Microsoft 365, Excel 2021, 2019 or 2016).
- A worksheet with data selected, or a cell inside the range you want to sort.
- A keyboard with a working Alt key — on some compact laptops check the Fn lock, since function keys and Alt can behave oddly with alternate layouts.
- Optional: OneDrive or a saved copy, if the sort is on important data you would not want to re-enter.
Step-by-Step
- Click any single cell inside your data. You do not need to highlight the whole table. If you select just one column, Excel may sort only that column and break the rows apart, so a single cell or the whole range is safer. For a controlled sort, select the entire range including headers before you start.
- Press Alt once and let go. The ribbon shows small letters over each tab: H for Home, N for Insert, P for Page Layout, M for Formulas, A for Data, and so on. If you see nothing, the focus may be in the formula bar; press Esc once and try again. Menu letters can differ slightly depending on your Excel version, language pack and any customised ribbon, so if D does not open Data, look at the letters actually shown.
- Press D. This jumps to the Data tab and shows Key Tips for its buttons. The Data tab holds Sort, Filter, Text to Columns, Remove Duplicates and the group commands.
- Press F. This selects the Sort & Filter group, revealing the letter for each command in it. Note that F here is the group letter, not a function key — you are pressing the plain letter F.
- Press S. The Sort dialog box opens. If your range contains a header row, Excel usually ticks “My data has headers” automatically; check it, because a wrong header setting can push your first row into the sort as data.
- Choose what to sort by. In the Sort by dropdown, pick the column. In Sort On, choose Cell Values, Cell Color, Font Color or Conditional Formatting Icon. In Order, choose A to Z, Z to A, or a custom list for things like month names or weekday names so they sort in calendar order rather than alphabetically.
- Add levels if needed. Click Add Level to sort by a second column when the first has duplicates — for example, sort by Department, then by Last Name within each department. Use the up and down arrows to set which level runs first.
- Check the Options button if something looks wrong. The Options dialog lets you set whether the sort is case sensitive and which orientation it uses (top to bottom for columns, left to right for rows). Left-to-right is how you sort columns into a chosen order, which is a different task from sorting rows.
- Press Enter or click OK. Excel reorders the rows. If the result is wrong, press Ctrl+Z immediately to undo — a single undo usually restores the previous order completely, provided you have not done other edits since.
Common Mistakes
- Selecting one column instead of one cell or the whole range. This is the most common cause of scrambled data: Excel asks whether to expand the selection, and choosing the wrong answer in that prompt sorts the column alone and separates values from their rows.
- Holding Alt while typing D, F, S. The shortcut is sequential. Alt+D, F, S (each key tapped in turn) also works in many builds, but Alt held down with the letters does nothing useful. Tap, release, tap, release.
- Forgetting the header checkbox. If “My data has headers” is unticked, your column titles get sorted into the data as if they were values and end up somewhere in the middle of the list.
- Sorting a table that has blank rows. Excel treats a blank row as the end of the range, so anything below it gets left behind. Delete or fill blank rows first, or convert the range to an Excel Table with Ctrl+T so the whole table sorts together.
- Sorting formulas that reference fixed cells. Rows move but absolute references do not follow the way you expect. Check key formulas after a sort.
Tips
- You can press Alt, A, S, A as a quicker route to the same dialog from the Data tab — but the Alt+D, F, S sequence is the one that survives when the ribbon is collapsed.
- For a plain A-to-Z sort of the selected range, the toolbar Sort button is faster. The dialog is for multi-level and custom sorts.
- Ctrl+Shift+L toggles filters on a table or range. Combining filters with Sort gives you a quick, reversible way to inspect data without changing its stored order.
- Convert data ranges to Excel Tables (Ctrl+T). Tables remember header settings, expand automatically and sort cleanly, which removes most of the header and blank-row problems above.
- Keep a copy of the original order in a spare column (fill with 1, 2, 3...) so you can restore it later if a sort goes wrong after you have made other edits and undo is no longer available.
Troubleshooting
- Nothing happens when I press Alt. Click a cell first, press Esc to leave the formula bar, and confirm the workbook window is active (not just Excel in the background). If Key Tips still do not appear, check whether your keyboard has an Alt Gr or a laptop Fn key interfering; try the right-hand Alt key.
- Alt opens the menu bar instead of Key Tips (older Excel builds). In Excel 2003 and earlier the sequence was different: Alt+D opened the Data menu and F then S navigated it. If you are on a modern build and see the old menu bar, you are likely in a different application's window.
- D does not select the Data tab. Ribbon letters depend on version, language and customisation. Add a custom tab or a Quick Access Toolbar item and the letters shift. Use the mouse to open Data, or remove customisations in Options > Customize Ribbon.
- The dialog opens but the sort is wrong. Cancel, undo with Ctrl+Z, then reselect the whole range including headers before reopening the dialog. Verify the header checkbox and the order setting.
- The wrong column sorted. Check whether you had a filter applied — hidden rows sort too, and they can reappear in unexpected places. Clear filters before sorting if you want the whole dataset reordered.
- Excel asks about expanding the selection. If your data has adjacent columns, answer Expand the selection when you intend to reorder whole rows. Choose Continue with the current selection only when you genuinely want to sort one column independently.
Frequently Asked Questions
Does Alt+D, F, S work on Excel for Mac?
No. Mac Excel uses its own menu shortcuts rather than Windows Key Tips, so the sequence does not open Sort. Use the Data menu on the Mac ribbon or your configured menu shortcuts instead.
Does it work in Excel for the web?
Not the same way. Browser Excel supports some keyboard shortcuts, but the Key Tip sequence is a desktop Windows feature. Open the Data tab with the mouse in the browser version.
What is the difference between Alt+D, F, S and Alt, A, S, A?
Both reach the Sort dialog. Alt, A, S, A navigates the Data tab directly; Alt, D, F, S uses the older-style sequence that still works in current Windows builds. The ribbon route is more predictable if your version's letters differ.
Can I sort by more than one column at once?
Yes. After the dialog opens, click Add Level and set each level's column and order. Excel applies the levels top to bottom, with the first level as the primary sort.
Why did my data get scrambled after using the shortcut?
Almost always because only part of the range was selected, or the expand-selection prompt was answered the wrong way. Undo with Ctrl+Z, select the full range including headers, and sort again.
Is there a single-key way to sort A to Z?
Not by default in Excel. You can assign a macro to a shortcut key, but the built-in route is the Sort button on the Data tab or the dialog itself.