Learning Objectives
By the end of this lesson, you will be able to:
- Sort on one or multiple levels without breaking rows
- Filter with AutoFilter and custom number filters
- Highlight patterns with conditional formatting and colour scales
- Split combined text with Text to Columns
- Restrict inputs with data validation lists
- Freeze panes and set repeating print titles for readable prints
Sample file: sales_data_large.csv (240 rows)
What Clean Data Looks Like
Every tool in this lesson trusts the same foundation. One header row, no blank rows inside the block, no merged header cells, and a single record per row. Break the foundation and sort mixes names, filter misses rows, Text to Columns overwrites data. Check the foundation, then use the tools.
| Tool | Where It Lives | Business Question It Answers |
|---|---|---|
| Sort | Data then Sort | Which regions sell most? What is the ranked order? |
| Filter | Data then Filter | Show only West with Units greater than 5 |
| Conditional Formatting | Home then Conditional Formatting | Where are values above Rs. 20,000? |
| Text to Columns | Data then Text to Columns | Split Pokhara-PKR into City and Code |
| Data Validation | Data then Data Validation | Allow only North, South, East, West |
| Freeze Panes | View then Freeze Panes | Keep headers visible while scrolling |
| Print Titles | Page Layout then Print Titles | Repeat row 1 on every printed page |
Before you start: import the CSV to a sheet named Sales, confirm one header row with no blanks inside, and optionally select the data and press Ctrl+T to create an Excel Table so filters and structured refs are included.
1) Sort
Click one cell inside the data. Go to Data then Sort.
- For a single column sort, choose the column and order A to Z or Largest to Smallest.
- For a multi level sort, click Add Level. Example: Level 1 Region A to Z, Level 2 Sales Amount Largest to Smallest.
- Always choose Expand the selection when prompted so entire rows move together. Sorting one column alone detaches names from sales.
2) Filter
Go to Data then Filter, or use Table filters if you created a Table.
- Click the drop down on Region and tick West.
- On Units Sold, open Number Filters then Greater Than and enter 5. This two stage filter mirrors Model Lab Test Set A style thresholds.
- Before you build a Pivot Table from the same sheet, choose Data then Clear or filter from the Table source so the pivot sees the full dataset when you need it to.
Use Custom filter tip: Number Filters then Greater Than for discount or revenue thresholds rather than manual row hiding.
3) Conditional Formatting
Select the numeric column without the header.
- Go to Home then Conditional Formatting then Color Scales and pick Green Yellow Red. High sales trend green, low trend red.
- Add a second rule for a Status helper column if you built one: Highlight Cells Rules then Text that Contains Low to red fill, High to green fill.
- Keep rules few and meaningful. Colour is for scanning, not decoration. Two rules per sheet often suffice.
Manage and delete rules from Conditional Formatting then Manage Rules if the sheet becomes crowded.
4) Text to Columns
Use when one column holds combined values such as Pokhara-PKR or Kathmandu-KTM.
- Insert a blank column to the right of the combined column so split data has somewhere to go without overwriting.
- Select the combined column. Go to Data then Text to Columns.
- Choose Delimited, tick the delimiter such as hyphen, then Finish.
- Rename the new headers to City and Code.
Practise on ten to fifteen sample rows before running it on the full data.
5) Data Validation
Validation prevents bad inputs at the source rather than fixing them later.
- Select the cells that should hold Region.
- Go to Data then Data Validation then List.
- In Source enter
North,South,East,Westor point to a named range on another sheet such as =Regions. - Add an Input Message to guide entry and an Error Alert that stops invalid values.
Typing Central will then trigger the error and keep the dataset clean.
6) Freeze Panes and Print Titles
Freeze: go to View then Freeze Panes then Freeze Top Row to keep row one visible while scrolling. Use Freeze Panes with a selected cell to freeze both rows and columns if needed.
Print titles: go to Page Layout then Print Titles, set Rows to repeat at top to $1:$1. Open Print Preview and page to page two to confirm headers repeat. Without this, page two prints numbers with no column names.
Errors and Fixes
| Problem | Cause | Fix |
|---|---|---|
| Sorting mixes up rows so names no longer match sales | Only one column selected before sort | Undo, click one cell inside the data and sort the whole range with Expand the selection |
| Filter shows no data | Filters left on from a previous task | Data then Clear, then apply the new filter |
| Some rows left out of sort or filter | Blank rows inside the data block | Remove blank rows or convert the range to a Table with Ctrl+T |
| Text to Columns overwrites data to the right | No empty column inserted | Insert blank columns before splitting |
| Headers do not repeat when printed | Print Titles not set | Page Layout then Print Titles then Rows to repeat at top $1:$1 |
| Validation allows Central | List source misspelled or not applied to the correct range | Reselect the range and reapply List North,South,East,West |
| Colour scale not meaningful | Applied to text or to the header row | Select numbers only, exclude the header |
Nepal Worked Example: Sorted Filtered Validated Sheet - BS 2081-10-05
A student works on 2081-10-05 BS with an eight row extract from sales_data_large.csv. Sales are in NPR.
| Region | Salesperson | Units | Sales Rs. |
|---|---|---|---|
| East | Ram | 12 | 24,000 |
| West | Sita | 5 | 9,500 |
| North | Hari | 8 | 16,800 |
| West | Gita | 15 | 31,500 |
| South | Bikash | 3 | 5,400 |
| East | Anita | 9 | 18,900 |
| West | Kiran | 7 | 12,600 |
| North | Maya | 11 | 22,000 |
Multi level sort: Data then Sort with Region A to Z and Sales Largest to Smallest. Expected order: East Ram 24,000 then Anita 18,900, North Maya 22,000 then Hari 16,800, South Bikash 5,400, West Gita 31,500 then Kiran 12,600 then Sita 9,500. Eight rows stay intact with no mismatched names.
Filter: Data then Filter, Region equals West, Units Number Filters Greater Than 5. Result is 2 rows: Gita 15 and Kiran 7. Sita is excluded because 5 is not greater than 5, which tests the boundary correctly.
Conditional formatting: Select Sales Rs. without the header, Home then Conditional Formatting then Highlight Cells Rules then Greater Than 20,000. 3 cells highlight: Ram 24,000, Gita 31,500, Maya 22,000. A colour scale variant shades the full column from red at 5,400 to green at 31,500.
Text to Columns sample: In a helper column, entries such as Pokhara-PKR, Kathmandu-KTM, Butwal-BWA are split with Delimited hyphen into City and Code. Counted result: 3 rows split into 6 cells with no overwrite because a blank column was inserted first.
Data validation: On an empty Region input range, List North,South,East,West with Error Alert Stop. Typing Central triggers the error, typing East succeeds.
Freeze and print: View then Freeze Top Row keeps headers visible past row 20. Page Layout then Print Titles $1:$1 repeats headers on page two, verified in Print Preview.
Self-check
After sorting, names no longer match their sales. The filter shows zero rows, Text to Columns overwrote the next column, and page two prints without headers. What fixes cover all four?
Summary
Clean the data to one header row with no blanks. Sort with Expand the selection, filter with Number Filters for thresholds, highlight with conditional rules that mean something, split combined values with Text to Columns into empty columns, restrict entry with validation lists, and keep the sheet readable with freeze and print titles.
Key Takeaways
- Always expand the selection when sorting, and use Add Level for multi column order.
- Use Number Filters Greater Than for business thresholds rather than manual hide.
- Apply conditional formatting to numbers only, keep two rules at most.
- Insert blank columns before Text to Columns and test on a small sample.
- Validation lists stop bad region names at entry. Add an error alert.
- Freeze Top Row and set $1:$1 to repeat headers in scroll and in print.
Discussion
Why does one blank row inside the block exclude rows below it from sort and filter? How does a validation list change who is responsible for data quality? What did you learn from the boundary test where 5 was not greater than 5?
Exercises
- Multi level sort (calculable): Sort the eight rows as above and list the full name order with sales values.
- Two stage filter: Filter to East only, then to Sales greater than 15,000. State the row count and grand sales of the filtered view.
- Rules: Apply a three colour scale to Sales and a Text that Contains rule to a helper Status column. List the count of highlighted cells for Greater Than 20,000.
- Validation, split, and print: Split three hyphen codes with Text to Columns, add a List for Region, freeze the header, set Print Titles $1:$1, and capture Print Preview on page two.
📚 Continue to: Pivot Tables and Charts


