Google Sheets QUERY most recent unique entries

只愿长相守 提交于 2020-01-04 21:38:22

问题


I am trying to use the QUERY function on a list of Google Form responses to only display the most recent of unique entries(based on the key Student ID).

A = Timestamp Column 
C = Student ID Column

Using:

select max(A)
group by C

I was able to get the right entries, but only one column for each(I want all the data, the whole row, from the right entries)

So I tried using:

select max(A),B,C,D,E,F,G,H 
group by C

But this gives an error

Unable to parse query string for Function QUERY parameter 2: ADD_COL_TO_GROUP_BY_OR_AGGB

I am new to databases, first time using QUERY. Sorry if this is confusing, but maybe the sheet makes more sense: spreadsheet


回答1:


In addition to Chris' contribution and using QUERY():

=ArrayFormula(vlookup(query({row(Raw!A:A),sort(Raw!A:J)},
"select max(Col1) where Col4 is not null group by Col4 label max(Col1)''",0),
{row(Raw!A:A),sort(Raw!A:J)},{2,3,4,5,6,7,8,9,10,11},1))



回答2:


Does this formula work as you want:

={Raw!A1:J1;FILTER(Raw!A2:J,MMULT((Raw!C2:C=TRANSPOSE(Raw!C2:C))*(Raw!A2:A<TRANSPOSE(Raw!A2:A)),SIGN(ROW(Raw!A2:A)))=0)}



来源:https://stackoverflow.com/questions/31632986/google-sheets-query-most-recent-unique-entries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!