Thursday, June 27, 2013

Google Spreadsheet Group By Query


(by Serg Valero)

Hello Everyone,

Hope I can explain myself, I have the following table

Client Course Date
1         A         1/10/2013
3         B         8/28/2011
3         B         10/15/2012
3         A         10/2/2013
1         A         4/8/2013
1         B         5/10/2013

I need to have the minimum date of each course by client for having a table like this:

Client Course Date
1         A         1/10/2013
1         B         5/10/2013
3         A         10/2/2013
3         B         8/28/2011

In excel I achieved it with =min(if( )), is there a way of doing it in spreadsheets? 



Have at the screenshot below:

I have the table data in Columns A,B and C.

I have the following formula in Cell E1:
=query(A:C;"select A,B,min(C) where B<>'' group by A,B label min(C) 'Date'")

And if you want to have the result in another sheet then put the following formula in another sheet:
=query('Sheet1'!A:C;"select A,B,min(C) where B<>'' group by A,B label min(C) 'Date'")

In above formula replace Sheet1 with your Sheet Name.

I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private and confidential projects:

If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: 


No comments:

Post a Comment