我试图在电子表格行中创建行子组,以便我可以对数据进行排序,但任何特定子组中的行都保持在一起。这可能是最容易用图片显示的内容。
按列数据对子组内的行进行排序
理想情况下,我想找到一种在Google电子表格中执行此操作的方法,但我敢打赌这是不可能的,因此欢迎使用任何类型的电子表格程序的解决方案。
好的,在Google电子表格中:
我创建了一个初始电子表格,看起来应该像这样(具有一些艺术上的自由)。下半部分尚未排序,因此等于上半部分:
Select the three columns that make the Category 1, then go to Data > Sort range
.
From there, just change the preset column (should be A) to C (aka, the 2nd criteria).
This part of the table is now sorted according to the 2nd criteria. Just repeat to the 2nd category.
The end result should be your table.
Based on @beroe suggestion, I was able to make up a little more.
First of, you need to add an extra column, that assigns Individual Categories to each of the items. Although this is feasible with your current data setup, I find it is the Right Thing To Do to have a table such as the following:
Note that I haven't yet sorted the data according to your 2nd criteria. Note also that next to the 2nd criteria is now a column that contains each item's respective Category.
Select all data, then go to Data > Sort Range
. In there Sort first by column D (the column with the Categories), after press add another sort column, and then add the column corresponding to the 2nd criteria (column C).
Why this works is because of an idea spreadsheet software has about precedence. As it is, Google will try to sort first by the column D. Afterwards, it will sort all remaining data by column C. All remaining data is already sorted.
Note that the order by which I placed the columns is this, due to the reason pointed before. If you tried to place Column C then column D, you wouldn't have your desired outcome.
The end result is something like this:
Ultimately, adding a column with the item's information is a good spreadsheet design decision (if there is something like this in existence).
最后一点,似乎Google Spreadsheet默认具有JavaScript功能(即,等同于Excel的Macros)。可以通过访问它Tools > Script Editor
。但是,我不知道如何编写JavaScript。最终,如果您需要更复杂的方法,则可以诉诸于此。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句