Microsoft Excel Mastery

Part III: Data Management

Sorting, Filtering, Data Validation, Data Cleaning, Tables & Named Ranges — with real Indian business examples from TCS, Flipkart, Reliance & Zomato.

šŸ“Š 5 Chapters  |  77+ Solved Examples  |  40+ Exercises  |  25 MCQs  |  15 Interview Questions  |  5 Mini Projects

Chapter 8

Sorting and Filtering

šŸŽÆ Learning Objectives

  • Sort data in ascending (A–Z) and descending (Z–A) order
  • Perform multi-level sorting (e.g., by Department then by Salary)
  • Sort by cell color, font color, and conditional formatting icons
  • Apply AutoFilter to filter data by value, text, number, and date conditions
  • Use Advanced Filter for criteria ranges, unique records, and copying results to another location
  • Master dynamic array functions: SORT(), SORTBY(), and FILTER()

šŸ¢ The Flipkart Problem: 150 Million Products

Flipkart's product catalog contains over 150 million listings. When a customer searches for "mobile phone," the system must sort results by relevance, price, rating, and delivery speed — all in under 200 milliseconds. In your Excel world, sorting and filtering are the foundational skills that mirror exactly what billion-dollar companies do with their databases every second.

Flipkart
Amazon India
Myntra
Pedagogy tip: Start with a messy, unsorted dataset on the projector. Ask students: "How would you find the top 5 highest-paid employees?" Let them struggle manually before introducing Sort. This builds intrinsic motivation. Use the sample dataset below for all demonstrations.
Emp IDNameDepartmentCitySalary (₹)Join DateRating
E001Amit SharmaITMumbai8500015-Jan-20204.5
E002Priya PatelHRDelhi6200003-Mar-20194.2
E003Rahul VermaITBangalore9200022-Jul-20214.8
E004Sneha GuptaFinanceMumbai7800010-Nov-20184.0
E005Vikram SinghITHyderabad9500005-Feb-20224.7
E006Anjali DesaiHRPune5800018-Aug-20203.9
E007Karan MehtaFinanceDelhi7200030-Apr-20194.3
E008Divya NairMarketingChennai6800012-Jun-20214.1
E009Rohan JoshiITPune8800025-Sep-20204.6
E010Meera IyerMarketingBangalore7100008-Dec-20194.4
Section 8.1

Sort Basics & Multi-Level Sorting

Simple Sort: A–Z and Z–A

Sorting arranges your data in a specific order. Ascending (A–Z) arranges text alphabetically, numbers from smallest to largest, and dates from earliest to latest. Descending (Z–A) does the reverse. Think of it like organizing your school register — names A to Z make it easy to look up any student.

Step-by-Step: Quick Sort

  1. Click any cell in the column you want to sort (e.g., click on cell E2 in the Salary column)
  2. Go to Data tab → Sort & Filter group
  3. Click Sort A to Z (↑) for ascending or Sort Z to A (↓) for descending
  4. Excel automatically detects the data range and sorts the entire table by that column
[Screenshot: Data tab ribbon showing Sort A to Z and Sort Z to A buttons highlighted]
Selecting only one column before sorting: If you select just one column (not the whole table), Excel will ask "Expand the selection?" Always choose Expand the selection — otherwise, you'll sort only that column and your data rows will become mismatched. Employee names might end up with wrong salaries!

Example 1: Sort employees by Salary (ascending)

Click any cell in the Salary column → Data → Sort A to Z. Result:

Emp IDNameDepartmentSalary (₹)
E006Anjali DesaiHR58,000
E002Priya PatelHR62,000
E008Divya NairMarketing68,000
E010Meera IyerMarketing71,000
E007Karan MehtaFinance72,000
E004Sneha GuptaFinance78,000
E001Amit SharmaIT85,000
E009Rohan JoshiIT88,000
E003Rahul VermaIT92,000
E005Vikram SinghIT95,000

Custom Sort & Multi-Level Sort

What if you want to sort by Department first, and then within each department, sort by Salary from highest to lowest? That's multi-level sorting — exactly how HR managers organize payroll reports at companies like TCS and Infosys.

Step-by-Step: Multi-Level Sort

  1. Click any cell in your data range
  2. Go to Data tab → click Sort (the full Sort button, not the quick A-Z buttons)
  3. In the Sort dialog:
    • Sort by: Department → Order: A to Z
    • Click Add Level
    • Then by: Salary → Order: Largest to Smallest
  4. Click OK
[Screenshot: Sort dialog box with two levels — Department A-Z, then Salary Largest to Smallest]

Example 2: Multi-level sort — Department (A–Z), then Salary (High to Low)

NameDepartmentSalary (₹)
Sneha GuptaFinance78,000
Karan MehtaFinance72,000
Priya PatelHR62,000
Anjali DesaiHR58,000
Vikram SinghIT95,000
Rahul VermaIT92,000
Rohan JoshiIT88,000
Amit SharmaIT85,000
Meera IyerMarketing71,000
Divya NairMarketing68,000

Custom Sort Order

Sometimes alphabetical order isn't what you want. For example, you might want months to sort as Jan, Feb, Mar... not Apr, Aug, Dec. Or departments in a specific business hierarchy: "Management → IT → Finance → HR → Marketing."

Step-by-Step: Custom Sort List

  1. Data → Sort → In the Order dropdown, select Custom List...
  2. Type your custom order in the List entries box (one item per line): Management, IT, Finance, HR, Marketing
  3. Click Add, then OK

Example 3: Sort by custom department order

Custom order: IT, Finance, HR, Marketing. Result: All IT employees appear first, then Finance, then HR, then Marketing — regardless of alphabetical order.

Sort by Cell Color / Font Color / Icon

If you've used conditional formatting to highlight cells (e.g., red for low performers, green for high performers), you can sort by those colors.

  1. Data → Sort → In Sort On, choose Cell Color, Font Color, or Conditional Formatting Icon
  2. Select the color/icon you want on top
  3. Add more levels for each color

Example 4: Sort by cell color

Suppose cells with Salary > ₹80,000 are highlighted green and Salary < ₹65,000 are red. Sort by Cell Color → Green on Top → Red on Bottom.

  • Alt + D + S — Open Sort dialog (legacy shortcut)
  • Alt + A + S + S — Sort Ascending (A–Z)
  • Alt + A + S + O — Sort Descending (Z–A)
  • Alt + A + S + U — Custom Sort dialog
Always keep a backup of your original data before sorting. Once sorted and saved, you cannot "unsort" back to the original order. A smart trick: add a column called "Original Order" with serial numbers 1, 2, 3... before sorting. You can always sort by that column to restore the original arrangement.

Example 5: Real-Life — CBSE Board Results Sorting

A CBSE school coordinator receives mark sheets for 500 students. She needs to sort by: Stream (Science, Commerce, Arts) first, then by Total Marks (highest first) within each stream, then by Name (A–Z) for students with the same marks.

Roll NoNameStreamTotal MarksRank
101Arjun ReddyScience4871
115Kavya MenonScience4782
203Neha AgarwalCommerce4721
207Suresh KumarCommerce4652
301Fatima KhanArts4581

Sort levels: 1) Stream → Custom List (Science, Commerce, Arts) 2) Total Marks → Largest to Smallest 3) Name → A to Z

Example 6: Real-Life — Zomato Restaurant Ratings Sort

A Zomato city manager exports restaurant data for Pune. He needs restaurants sorted by Cuisine (A–Z), then Rating (highest first), then Average Cost for Two (lowest first) to recommend affordable highly-rated options.