[英]How to get max values for each unique value in a different column in Google Sheets?
I have two columns, the first column (A) has names and the second column (B) has values.我有两列,第一列 (A) 有名称,第二列 (B) 有值。
A![]() |
B![]() |
---|---|
apple![]() |
10 ![]() |
orange![]() |
12 ![]() |
orange![]() |
14 ![]() |
apple![]() |
8 ![]() |
Is there a way to get only rows with unique names from A AND max values from B?有没有办法只从 A 中获取具有唯一名称的行,从 B 中获取最大值? So the result should look like this:
所以结果应该是这样的:
A![]() |
B![]() |
---|---|
apple![]() |
10 ![]() |
orange![]() |
14 ![]() |
I tried using different combinations of FILTER, QUERY and UNIQUE, but so far no luck.我尝试使用 FILTER、QUERY 和 UNIQUE 的不同组合,但到目前为止运气不好。 Note that the actual dataset I'm using is much larger than this, but the idea is the same.
请注意,我使用的实际数据集比这大得多,但想法是一样的。
use:利用:
=SORTN(SORT(A:B; 2; 0); 9^9; 2; 1; 1)
Should be doable directly within a query as well:也应该可以直接在查询中使用:
=query(A:B,"select A,max(B) where A is not null group by A")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.