I am trying to make row subgroups in my spreadsheet rows so that I can sort my data but have rows in any particular subgroup stay together. This is probably easiest to show with a picture.

Sorting rows within subgroups by column data

![enter image description here](https://i.stack.imgur.com/Q16K9.png)

Ideally I'd like to find a way to do this in Google spreadsheets, but I'd be willing to bet that it's not possible, so solutions for any type of spreadsheet program are welcome.