Sorting data is an integral part of data analysis. You might want to arrange a list of names in alphabetical order, compile a list of product inventory levels from highest to lowest, or order rows by colors or icons. Sorting data helps you quickly visualize and understand your data better, organize and find the data that you want, and ultimately make more effective decisions. Show
You can sort data by text (A to Z or Z to A), numbers (smallest to largest or largest to smallest), and dates and times (oldest to newest and newest to oldest) in one or more columns. You can also sort by a custom list you create (such as Large, Medium, and Small) or by format, including cell color, font color, or icon set. Notes:
Select a cell in the column you want to sort. On the Data tab, in the Sort & Filter group, do one of the following: To quick sort in ascending order, click To quick sort in descending order, click (Sort Z to A).Notes: Potential Issues
Notes:
Notes: Potential Issue
You may want to sort by more than one column or row when you have data that you want to group by the same value in one column or row, and then sort another column or row within that group of equal values. For example, if you have a Department column and an Employee column, you can first sort by Department (to group all the employees in the same department together), and then sort by name (to put the names in alphabetical order within each department). You can sort by up to 64 columns. Note: For best results, the range of cells that you sort should have column headings.
If you have manually or conditionally formatted a range of cells or a table column by cell color or font color, you can also sort by these colors. You can also sort by an icon set that you created with conditional formatting.
You can use a custom list to sort in a user-defined order. For example, a column might contain values that you want to sort by, such as High, Medium, and Low. How can you sort so that rows containing High appear first, followed by Medium, and then Low? If you were to sort alphabetically, an “A to Z” sort would put High at the top, but Low would come before Medium. And if you sorted “Z to A,” Medium would appear first, with Low in the middle. Regardless of the order, you always want “Medium” in the middle. By creating your own custom list, you can get around this problem.
It's most common to sort from top to bottom, but you can also sort from left to right. Note: Tables don't support left to right sorting. To do so, first convert the table to a range by selecting any cell in the table, and then clicking Table Tools > Convert to range.
Note: When you sort rows that are part of a worksheet outline, Excel sorts the highest-level groups (level 1) so that the detail rows or columns stay together, even if the detail rows or columns are hidden. To sort by a part of a value in a column, such as a part number code (789-WDG-34), last name (Carol Philips), or first name (Philips, Carol), you first need to split the column into two or more columns so that the value you want to sort by is in its own column. To do this, you can use text functions to separate the parts of the cells or you can use the Convert Text to Columns Wizard. For examples and more information, see Split text into different cells and Split text among columns by using functions. Warning: It is possible to sort a range within a range, but it is not recommended, because the result disassociates the sorted range from its original data. If you were to sort the following data as shown, the selected employees would be associated with different departments than they were before.
Fortunately, Excel will warn you if it senses you are about to attempt this:
If you did not intend to sort like this, then press the Expand the selection option, otherwise select Continue with the current selection. If the results are not what you want, click Undo .Note: You cannot sort this way in a table. If you get unexpected results when sorting your data, do the following: Check to see if the values returned by a formula have changed If the data that you have sorted contains one or more formulas, the return values of those formulas might change when the worksheet is recalculated. In this case, make sure that you reapply the sort to get up-to-date results. Unhide rows and columns before you sort Hidden columns are not moved when you sort columns, and hidden rows are not moved when you sort rows. Before you sort data, it's a good idea to unhide the hidden columns and rows. Check the locale setting Sort orders vary by locale setting. Make sure that you have the proper locale setting in Regional Settings or Regional and Language Options in Control Panel on your computer. For information about changing the locale setting, see the Windows help system. Enter column headings in only one row If you need multiple line labels, wrap the text within the cell. Turn on or off the heading row It's usually best to have a heading row when you sort a column to make it easier to understand the meaning of the data. By default, the value in the heading is not included in the sort operation. Occasionally, you may need to turn the heading on or off so that the value in the heading is or is not included in the sort operation. Do one of the following:
If your data is formatted as an Excel table, then you can quickly sort and filter it with the filter buttons in the header row. If your data isn't already in a
table, then format it as a table. This will automatically add a filter button at the top of each table column. Click the filter button at the top of the column you want to sort on, and pick the sort order you want. To undo a sort, use the Undo button on the Home tab.
Let's say you have a table with a Department column and an Employee column. You can first sort by Department to group all the employees in the same department together, and then sort by name to put the names in alphabetical order within each department. Select any cell within your data range.
If you have manually or conditionally formatted a range of cells or a table column by cell color or font color, you can also sort by these colors. You can also sort by an icon set that you created with conditional formatting.
It's most common to sort from top to bottom, but you can also sort from left to right. Note: Tables don't support left to right sorting. To do so, first convert the table to a range by selecting any cell in the table, and then clicking Table Tools > Convert to range.
Need more help?You can always ask an expert in the Excel Tech Community or get support in the Answers community. See alsoUse the SORT and SORTBY functions to automatically sort your data. What is the process of displaying only a portion of the data based on matching a specific value to show only the data that meets the criteria that you specify?Filtering Data
When data is filtered, only rows that meet the filter criteria will display and other rows will be hidden. With filtered data, you can then copy, format, print, etc., your data, without having to sort or move it first.
What is the process of moving within a worksheet or workbook called?Glossary. What is the term for the values that a function used to perform operations or calculations?Functions are predefined formulas that perform calculations by using specific values, called arguments, in a particular order, or structure.
Which function determines the largest value in a selected range of values?MAX will return the largest value in a given list of arguments. From a given set of numeric values, it will return the highest value.
|