Friday, March 2, 2018

yogi_Rearrange Data In Cells A:C In CrossTab Style

Google Spreadsheet   Post  #2386

Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     Mar-02-2018

question by: Pdufresn
https://productforums.google.com/forum/?utm_medium=email&utm_source=best_answer_notification_button#!topic/docs/BBUpA8RMnsk;context-place=forum/docs
Query
I have data as follows:

Test   Student    Grade
1        Apple       1
1        Orange    2
1        Banana    3
1        Grape       4
2        Apple       2
2        Orange    3
2        Banana    4
2        Grape       5
3        Apple       3
3      Orange      4 
3        Banana    5
3        Grape       6

I'd like to run a query so that I can have the following result

Test    Apple        Orange     Banana     Grape
1           1                  2              3               4
2           2                  3              4                5
3           3                  4              5               6

Can I achieve this using query? I'm trying to accomplish this using google script so a pivot table or filter won't work to get the result I'm looking for. I'm not too familiar with group but if someone knows how to do this that would be greatly appreciated!

Patrick