在Google表格中选择前n个唯一过滤的行

时间:2017-11-08 05:37:31

标签: google-sheets google-query-language

在Google表格中,我有一个这样的表格,超过10 000行:

A          B        C           D
Mewtwo     33,5     Confusion   Shadow Ball
Mewtwo     33,5     Confusion   Hyper Beam
Alakazam   38       Confusion   Futuresight
Dragonite  38,5     Dragon Tail Outrage
Mewtwo     33,5     Confusion   Focus Blast
Mewtwo     33,5     Psycho Cut  Shadow Ball
Rhydon     37,5     Mud Slap    Earthquake
Mewtwo     33,5     Psycho Cut  Hyper Beam
Mewtwo     33,5     Confusion   Psychic
Mewtwo     33,5     Psycho Cut  Focus Blast
Gengar     29       Shadow Claw Shadow Ball
Dragonite  38,5     Dragon Tail Dragon Claw
Dragonite  38,5     Dragon Tail Hyper Beam
Alakazam   38       Confusion   Shadow Ball
Mewtwo     28       Confusion   Shadow Ball
Gengar     33,5     Hex         Shadow Ball
Mewtwo     33,5     Psycho Cut  Psychic
Mewtwo     28       Confusion   Hyper Beam

我想要的是A,C和D的每个组合的第一个唯一行,B列中的编号最高,表已经按B排序。因此,对于上表,我需要一个过滤器来排除以下行:

Mewtwo     28       Confusion   Shadow Ball
Mewtwo     28       Confusion   Hyper Beam

然后添加: ARRAY_CONSTRAIN(...; 30; 4)获得前30名

1 个答案:

答案 0 :(得分:0)

=QUERY(A2:D10000,"select A, max(B),C, D group by A, C, D limit 30")