Menu

Sorting, Filtering, and Data Validation

Lesson 4: Sorting, Filtering, and Data Validation

What do sorting and filtering do?

Action

What it does

Changes data?

SortRearranges rows by one or more fieldsChanges row order only
FilterTemporarily hides rows that don't match conditionsNo – rows are hidden, not deleted

Warning: Sorting only one column instead of the whole table disconnects values from their records. Always select the full table, or use a formal table, before sorting.

Example

Goal: Inspect the largest South-region orders in July.

  1. Apply a filter: Region = South
  2. Apply a filter: Date between 1 July and 31 July
  3. Sort the visible rows by Revenue, largest to smallest

Multi-level sorting: Sort by Region (A–Z), then by Revenue (largest first) to see the top orders within each region.

Data validation

Validation rules restrict what can be entered into a cell.

Field

Validation rule

Prevents

RegionDropdown list (North, South, East, West)Typos like "Sooth"
QuantityWhole number > 0Negative or decimal quantities
Order dateDate between 2020-01-01 and todayImpossible future dates
EmailCustom rule containing "@"Obviously invalid entries
DiscountDecimal between 0 and 0.5Discounts above 50%

How it works

  • Use filters to investigate a subset, then clear them before calculating whole-dataset totals.
  • SUM includes hidden rows. SUBTOTAL and AGGREGATE (Excel) can ignore filtered-out rows:
    • =SUBTOTAL(9, F2:F100) sums only visible rows.
  • Always check whether hidden rows affect the formula you use.

Common mistakes

  • Treating a filtered view as the entire dataset.
  • Forgetting a filter is still active when sharing the file.
  • Assuming validation rules prove existing data is correct. Validation only applies to new entries. Imported or pasted records may still contain invalid values.
  • Sorting a range with blank rows, which splits the table into separate blocks.

Data Analytics Tutorial



Learn via Video Course

Data Analysis and Processing with Python using Pandas - Data Science Course Logo

Data Analysis and Processing with Python using Pandas - Data Science Course

5 hrs



Get in Touch For Details