英文:
How can I sort columns in EXCEL that are separated?
问题
我需要对一个Excel文件中的多个分开的列进行排序。对于相邻的列,没有问题,因为它选择了范围(例如,如果您想根据操作次数对客户进行排序,可以选择从列A到列C)。但是,当我想根据名义价值对客户进行排序时,当选择范围A:D时,它还会选择列C,而现在我不再需要它。因此,我需要一个可以对我感兴趣的列进行排序而不包括所有列的公式。
我已经在第一个(简单)示例中使用了这个公式:=SORT(A2:C12;3;-1;FALSE)
但当我尝试对列A、B和D进行排序时,会出现以下情况(我不希望列C出现)。
我尝试避免或删除不感兴趣的列,但没有效果。
英文:
I need to sort multiple columns of an excel file that are separate. For columns that are next to each other, there is no problem because it is selecting the range (as an example of column A to C if you wanted to order the customers based on the number of operations). At the moment in which I want to order the clients according to their nominal value, when selecting the range A:D, it also selects column C, which now no longer interests me. So I need a formula that sorts the columns I'm interested in and doesn't include all of them.
I have been using this formula for the first (easy) example: =SORT(A2:C12;3;-1;FALSE)
But when I try to sort the columns A, B and D, happens the following (and I dont the column C to appear):
I have tried to avoid or deleting the columns which don´t interest me, but doesn´t work
答案1
得分: 1
=SORT(CHOOSECOLS(A2:E12,1,2,4),3,-1)
或者如果您想要更加动态化:
=LET(cols, {1,2,4},
d, FILTER(CHOOSECOLS(A:E,cols),A:A<>""),
header, TAKE(d,1),
data, DROP(d,1),
VSTACK(header,SORT(data,3,-1)))
英文:
You can use CHOOSECOLS to make the selection of the columns you need and sort these:
=SORT(CHOOSECOLS(A2:E12,1,2,4),3,-1)
Or if you want it to be more dynamical:
=LET(cols, {1,2,4},
d, FILTER(CHOOSECOLS(A:E,cols),A:A<>""),
header, TAKE(d,1),
data, DROP(d,1),
VSTACK(header,SORT(data,3,-1)))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论