Sorting Data in Excel
Sorting in Excel helps organize data alphabetically, numerically, or by date. You can sort by one column, multiple columns, or use custom sorting options.
1. How to Sort Data in Excel
Sort in Ascending or Descending Order
- Select the data range (including headers, if applicable).
- Go to Home → Click on Sort & Filter.
- Choose:
- Sort A to Z (Ascending)
- Sort Z to A (Descending)
Example: Sorting Names Alphabetically
After sorting by Name (A to Z): | Name | Age | |--------|----| | Alice | 22 | | David | 35 | | Emma | 28 |
2. Sorting by Multiple Columns
To sort by more than one column, follow these steps:
- Select your data range.
- Click Sort & Filter → Custom Sort.
- In the Sort window:
- Choose the first column to sort (e.g., "Department").
- Click Add Level to sort by a second column (e.g., "Salary").
- Click OK.
Example: Sorting Employees by Department (A to Z), then by Salary (Largest to Smallest)
After sorting:
- Sort by Department (A-Z) → HR first, then IT
- Sort by Salary (Largest to Smallest)
| Name | Department | Salary | |--------|-----------|--------| | Alice | HR | 50000 | | David | HR | 45000 | | Charlie| IT | 70000 | | Bob | IT | 60000 |
3. Sorting by Date
- Select the column with dates.
- Click Sort & Filter → Choose Sort Oldest to Newest or Newest to Oldest.
Example
After sorting (Oldest to Newest): | Name | Date Joined | |-------|-------------| | Bob | 2021-08-10 | | Emma | 2022-02-15 | | Alice | 2023-05-12 |
4. Custom Sorting (e.g., Sorting by Month Name)
- Select the column.
- Click Sort & Filter → Custom Sort.
- In the Order dropdown, choose Custom List.
- Enter a list manually, like January, February, March...
Example: Sorting by Month Name
After sorting using a custom list:
| Name | Month |
|-------|--------|
| Bob | January|
| Emma | February|
| Alice | March |
5. Sorting with Formulas
If you want to dynamically sort data, you can use Excel’s SORT function (available in Excel 365 and Excel 2019).
Example: Sorting a List Alphabetically
=SORT(A2:A10)
- This formula sorts column A in ascending order.
Sorting by Multiple Columns
=SORT(A2:C10, 2, 1)
- This sorts range A2:C10 by the 2nd column in ascending order.
0 comments:
Post a Comment