I have two columns, the first column (A) has names and the second column (B) has values.
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? 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. Note that the actual dataset I'm using is much larger than this, but the idea is the same.
CodePudding user response:
use:
=SORTN(SORT(A:B; 2; 0); 9^9; 2; 1; 1)
CodePudding user response:
Should be doable directly within a query as well:
=query(A:B,"select A,max(B) where A is not null group by A")