How to query the maximum number for each group in Google Sheets

Viewed 2827

I wish to have the maxim date for each group in a separate column:

This is my data:

Customer  Date   

A          5/6/2017
A          11/7/2017
B          5/7/2017
A          9/7/2017
B          4/5/2017

And this will be my ideal output:

Customer   Date             MAX    

A          5/6/2017       11/7/2017
A          11/7/2017      11/7/2017   
B          5/7/2017       5/7/2017
A          9/7/2017       11/7/2017
B          4/5/2017       5/7/2017

That caluclate the maximum date for each group (in this example Group A and Group B) and return the value.

I tried this query

={"MAX";arrayformula (QUERY( A:B, "Select MAX(B) group by (A)"))}

But It doesn't give me what I'm looking for. Any tip is really appreciated.

1 Answers
Related