Sorting Data

The Excel sort function is useful for rearranging data. When working in Excel sorting data can quickly reorganize content too.

Introduction

Lesson 11

With more than 17 billion cells in a single worksheet, Excel 2010 gives you the ability to work with an enormous amount of data. Arranging your data alphabetically, from smallest to largest, or using other criteria can help you find the information you're looking for more quickly.

In this lesson, you will learn how to sort data to better view and organize the contents of your spreadsheet.

Basic sorting

Video: Sorting Data in Excel 2010

Launch video!Watch the video (3:45).

Sorting is a common task that allows you to change or customize the order of your spreadsheet data. For example, you could organize an office birthday list by employee, birthdate, or department, making it easier to find what you're looking for. Custom sorting takes it a step further, giving you the ability to sort multiple levels—such as department first, then birthdate—to group birthdates by department.

Optional: You can download this example for extra practice.

To sort in alphabetical order:

  1. Select a cell in the column you want to sort by. In this example, we'll sort by Last Name.
    Selecting a column to sortSelecting a column to sort
  2. Select the Data tab, then locate the Sort and Filter group.
  3. Click the ascending command sort ascending to Sort A to Z or the descending command sort ascending to Sort Z to A.
    Sorting in ascending alphabetical orderSorting in ascending alphabetical order
  4. The data in the spreadsheet will be organized alphabetically.
    Sorted by last name, from A to ZSorted by last name, from A to Z

Sorting options can also be found on the Home tab, condensed into the Sort & Filter command.

To sort in numerical order:

  1. Select a cell in the column you want to sort by.
    Selecting a column to sortSelecting a column to sort
  2. From the Data tab, click the ascending command sort ascending to Sort Smallest to Largest or the descending command sort ascending to Sort Largest to Smallest.
  3. The data in the spreadsheet will be organized numerically.
    Sorted by homeroom number, from smallest to largestSorted by homeroom number, from smallest to largest

To sort by date or time:

  1. Select a cell in the column you want to sort by.
    Selecting a column to sortSelecting a column to sort
  2. From the Data tab, click the ascending command sort ascending to Sort Oldest to Newest or the descending command sort ascending to Sort Newest to Oldest.
  3. The data in the spreadsheet will be organized by date or time.
    Sorted by payment date, from oldest to newestSorted by payment date, from oldest to newest

Custom sorting

To sort in the order of your choosing:

You can use a Custom List to identify your own sorting order, such as days of the week—or in this example, T-shirt sizes from smallest to largest.

  1. From the Data tab, click the Sort command to open the Sort dialog box.
    Opening the Sort dialog boxOpening the Sort dialog box
  2. Identify the column you want to Sort by by clicking the drop-down arrow in the Column field. In this example, we'll choose T-Shirt Size.
    Selecting a column to sort bySelecting a column to sort by
  3. Make sure Values is selected in the Sort On field.
  4. Click the drop-down arrow in the Order field, then choose Custom List.
    Choosing to order by Custom ListChoosing to order by Custom List
  5. Select NEW LIST, and enter how you want your data sorted in the List entries box. We'll sort T-shirt sizes from smallest to largest.
  6. Click Add to save the list, then click OK.
    Creating a custom listCreating a custom list
  7. Click OK to close the Sort dialog box and sort your data.
    Clicking OK to sortClicking OK to sort
  8. The spreadsheet will be sorted in order of Small, Medium, Large, and X-Large.
    Sorted by t-shirt size, from smallest to largestSorted by t-shirt size, from smallest to largest

To sort by cell color, font color, or cell icon:

  1. From the Data tab, click the Sort command to open the Sort dialog box.
  2. Identify the column you want to Sort by by clicking the drop-down arrow in the Column field.
  3. Choose whether you want to sort by Cell Color, Font Color, or Cell Icon in the Sort On field. In this example, we'll sort by Font Color.
    Choosing to sort on Font ColorChoosing to sort on Font Color
  4. In the Order field, click the drop-down arrow to choose a color, then decide whether you want it ordered On Top or On Bottom.
    Selecting a font colorSelecting a font color
  5. Click OK. The data is now sorted by attribute rather than text.
    Sorted by font colorSorted by font color

Sorting multiple levels

Another feature of custom sorting—sorting multiple levels—allows you to identify which columns to sort by and when, giving you more control over the organization of your data. For example, you could sort by more than one cell color—such as red, then yellow, then green, to indicate different levels of priority—or, as seen below, you could sort students by homeroom number, then by last name.

To add a level:

  1. From the Data tab, click the Sort command to open the Sort dialog box.
  2. Identify the first item you want to Sort by. In this example, we will sort Homeroom # from Smallest to Largest.
  3. Click Add Level to add another item.
    Adding a levelAdding a level
  4. Identify the item you want to sort by next. We will sort Last Name from A to Z.
    Choosing criteria for a second levelChoosing criteria for a second level
  5. Click OK.
  6. The spreadsheet will be sorted so homeroom numbers are in order, and within each homeroom, that students are listed alphabetically by last name.
    Sorted by multiple levelsSorted by multiple levels

Copy Level will add a level by duplicating the one you have selected and allowing you to modify the sorting criteria. This is useful if you need to sort multiple levels that share some criteria, such as the same Column, Sort On, or Order.

To change the sorting priority:

  1. From the Data tab, click the Sort command to open the Custom Sort dialog box.
  2. Select the level you want to reorder.
  3. Use the Move Up or Move Down arrows. The higher the level is on the list, the higher its priority.
    Changing the sorting priorityChanging the sorting priority
  4. Click OK.

Challenge!

  1. Open an existing Excel 2010 workbook. If you want, you can use this example.
  2. Sort a column in ascending sort ascending or descending sort descending order. If you are using the example, sort by Homeroom #.
  3. Add a second level, and sort it according to cell color, font color, or cell icon. If you are using the example, add a second and third level to sort by the red and grey fonts used in T-Shirt Color.
  4. Add another level, and sort it using a Custom List. If you are using the example, sort by T-Shirt Size in the order of Small, Medium, Large, and X-Large.
  5. Change the sorting priority. If you are using the example, reorder the list to sort by T-Shirt Color (red), then by T-Shirt Color (grey), then by T-Shirt Size, then by Homeroom #.