Sub topic 9
Sorting and Filtering Table Data
Assume you can select ranges, enter data, and write simple formulas such as SUM. You should also understand A1 notation, such as A1:E4. This chapter uses a table named Orders.
Sorting changes the order of rows. Filtering hides rows that do not match a condition. Neither operation deletes data.
Sort rows in a table
Open the menu in a table header, such as Order Date. Choose a sort direction:
- Sort A to Z sorts text from A to Z, numbers from smallest to largest, and dates from oldest to newest.
- Sort Z to A reverses that order.
Sheets sorts the table body as complete rows. For example, when you sort by Amount, the customer, date, and payment status stay with the correct order.
The sort applies to the table, not automatically to unrelated cells elsewhere on the sheet. Keep related columns inside the same table. Otherwise, data outside the table can become misaligned with the sorted rows.
flowchart TD
A[Open a table column menu] --> B{Choose an operation}
B -->|Sort| C[Reorder complete table rows]
B -->|Filter| D[Hide rows that do not match]
C --> E[Other columns keep their row relationships]
D --> F[Visible rows show the current subset]caption: Sorting and filtering follow different paths alt: A flowchart showing that sorting reorders complete rows while filtering hides rows that do not match.
Filter table data
Open a header menu and use its filter controls. You can usually filter by:
- Selected values, such as only
AcmeandGlobex - A condition, such as amounts greater than
200 - Text or date conditions, such as dates after January 1, 2026
- Empty or non-empty cells
For example, filter the Paid column to show only TRUE. The unpaid rows are hidden, but they remain in the table. Remove the filter to show all rows again.
A filter can be combined with another filter. For example:
- Filter Paid to
TRUE. - Filter Amount to values greater than
200. - The table now shows paid orders above 200.
The filters work together as an AND condition. A row must pass every active filter to remain visible.
| Operation | What happens | Does it delete data? |
|---|---|---|
| Sort | Reorders table rows | No |
| Filter | Hides rows that fail conditions | No |
| Clear filter | Shows the hidden rows again | No |
Protect related calculations
A formula outside the table can summarize the table while filters change which rows are visible. A normal SUM includes all matching table rows, including rows hidden by a filter.
=SUM(Orders[Amount])If you need a calculation based only on visible rows, check the function's behavior before relying on it. Filtered visibility and manually hidden rows can be treated differently by some functions. Test the result with a small sample before using it in a report.
Filters also affect what you see when you copy or inspect the table, so clear filters before sharing a sheet if readers need to see every record. A visible filter indicator in a header helps explain why some rows are missing from view.
Common sorting and filtering errors
Sorting only one column
Do not select one column and sort its cells separately when the values belong to complete records. That can separate an order amount from its customer. Sort from the table's header menu so Sheets moves complete rows.
Filtering the wrong range
Confirm that the header belongs to the intended table. A nearby plain range may have similar column names but will not share the table's filter state.
Losing track of an active filter
If row numbers skip or expected records do not appear, inspect each table header for an active filter. Clear the filter or choose Select all in the filter values.
Confusing filtering with deletion
A filtered row still participates in table-based formulas such as =SUM(Orders[Amount]). If you need to remove records permanently, clear the filter first, review the full table, and then delete the selected rows deliberately.
Exercise
The Orders table shows only paid orders after you filter the Paid column to TRUE. What happened to the unpaid orders, and how can you show them again?
Show answer
The unpaid orders are hidden, not deleted. Open the Paid column menu and clear the filter, or choose all values.