How to Sort Data by Multiple Criteria in Excel

Tap through each step in order.

  1. Select the data range you want to sort

    Select the entire table you want to sort by multiple criteria, such as department and name.

  2. Open the Data tab and click Sort

    On the ribbon, open the "Data" tab and click "Sort" in the Sort & Filter group.

  3. Set the first sort level

    In "Sort by," choose a column, such as "Department," as your first sort key.

  4. Click Add Level for a second sort key

    Click "Add Level" and choose a second column, such as "Name," to sort within each group formed by the first key.

  5. Why it is worth using

    When you also want rows within the same department re-sorted alphabetically by name, adding sort levels in order lets you organize your data exactly the way you want in a single pass.

One sort key was not enough?

Sorting by department alone leaves the rows within each department in an arbitrary order. Grouping by department first, then sorting by name as a second level, arranges the whole table neatly by both criteria in a single operation.

You can also sort by cell color, font color, or icon

Beyond alphabetical or numeric order, the "Order" dropdown for each level also offers "Cell Color," "Font Color," and "Cell Icon." This lets you sort rows you've manually highlighted or flagged with conditional formatting icons to the top, which is useful for quickly grouping items you've already marked for attention.

Frequently Asked Questions

How many sort levels can I add?

Excel allows up to 64 sort levels, which is far more than enough for almost any real-world sorting need.

Can I change the order of the levels afterward?

Yes β€” select a level row in the Sort dialog and click the up or down arrow buttons to change its priority in the sort order.