# Sorting, grouping and freezing

Sorting orders rows by a column. Grouping gathers rows that share a value into collapsible blocks. Freezing pins the leading columns so they stay put while the rest scrolls sideways. The first two change which row you are looking at and the third only changes where it sits on screen — which is why grouping and sorting interact and freezing never does.

- **Status:** Available
- **Audience:** both
- **In the app:** #/data
- **Last verified:** 2026-09-10
- **Canonical:** https://connectbyjbrh.com/docs/files-data/data-sorting-grouping/

## Three controls, two kinds

| Control | Changes | Survives a reload only if saved |
|---|---|---|
| Sort | The order rows appear in | Yes — save it in a [view](/docs/files-data/saved-views/) |
| Group | How rows are gathered, and adds a count per group | Yes |
| Freeze | Which columns stay on screen when you scroll right | Yes |
| None of them | The records themselves | — |

None of the three writes anything. A sheet you have sorted, grouped and frozen is the same set of records as the sheet you started with, viewed differently, and closing the screen leaves the workspace exactly as it was.

## How grouping and sorting fit together

Grouping wins the outer order: rows are collected under their group first, and the sort then arranges rows inside each group. That is almost always what you want — deals by stage, newest first within each stage — and it is the usual explanation for a sort that appears to have been ignored.

1. Group by the column that defines the buckets you think in — stage, owner, channel, status.
   - Result: The sheet collapses into blocks with a count on each, and the shape of the work becomes visible before you read a single row.
2. Sort by the column that decides priority inside a bucket.
   - Result: Each block is ordered the way you would order it by hand.
3. Collapse the groups you are not working on.
   - Result: A long sheet becomes a short list of headings you can scan.

Group counts are computed over the whole sheet rather than over the rows rendered on screen, so a collapsed group showing a large number is telling you the truth about the sheet, not about your scroll position.

## Choosing something worth grouping by

- **Good:** a column with a handful of values — stage, status, owner, channel, lifecycle. The groups mean something and there are few enough to read.
- **Bad:** a column that is nearly unique per row, such as an email address or a created timestamp. You get one group per row and a longer sheet than you started with.
- **Worth a thought:** a date. Grouping by an exact date is usually the unique-per-row mistake wearing a disguise; sorting by it is what you actually wanted.
- **Empty values group too.** Rows with nothing in the grouped column gather under an empty heading, which is often the most interesting block on the sheet.

## Freezing, and where it stops helping

Freezing keeps the identifying columns — usually the name — visible while you scroll into the fields you are comparing. It is the difference between reading a wide sheet and guessing which row you are on.

**Freeze from the left** — Frozen columns are the leading ones. Freezing a column effectively decides its position, so freeze after you have finished [reordering](/docs/files-data/data-columns/).
**Freeze sparingly** — Every frozen column costs width that the scrolling part no longer has. Two is usually plenty; four leaves nothing to scroll.
**Freezing is not pinning a row** — It holds columns, not rows. Keeping a particular record in view is a job for a filter.
**Small screens** — There is not enough width for freezing to earn its place, which is one of the things the [small-screen layout](/docs/files-data/data-mobile/) drops.

> **Note** If a sheet looks wrong, undo in this order: clear the grouping, then the sort, then the freeze. Grouping changes the most and freezing changes the least, so working from the most disruptive control backwards finds the cause fastest.

## Questions

### Can I sort by two columns at once?

Grouping is how you get a second level in practice: group by the coarse column and sort within it by the fine one. That produces the reading you wanted and, unlike a hidden secondary sort, it is visible on the screen to whoever looks at it next.

### Does sorting on a hidden column work?

Yes, and it is a frequent source of confusion. The order is real but its reason is off-screen, so a sheet can look arbitrarily arranged. Show the column while you are working out what the sort is doing.

### Do groups reflect the whole sheet or just what is loaded?

The whole sheet. Rows are virtualised for rendering only; the grouping and its counts are computed over every row that matches your filters, which is what makes a collapsed group a usable summary.

## Related

- [The Data grid](https://connectbyjbrh.com/docs/files-data/data-grid/)
- [Columns, order and visibility](https://connectbyjbrh.com/docs/files-data/data-columns/)
- [Filtering and searching a sheet](https://connectbyjbrh.com/docs/files-data/data-filtering/)
- [Saved views](https://connectbyjbrh.com/docs/files-data/saved-views/)
- [The grid on a small screen](https://connectbyjbrh.com/docs/files-data/data-mobile/)
- [Sales in Connect](https://connectbyjbrh.com/docs/sales/)

## What this page is based on

- docs-source/sources/GENERAL.md §9 — the Data grid and its controls
- `backend/app/data_workspace.py`, `workspace_data_api.py`
- Connect capability registry (docs-source/facts.py) — `data_workspace`
