Selecting all rows with distinct column values - Google query language

纵饮孤独 提交于 2019-12-25 16:25:48

问题


Consider the following table :

Test Name  Bug name  Status
Name1            Bug1        Fail
Name2            Bug1        Fail
Name3            Bug2        Fail
Name4            Bug3        Fail
Name5            Bug4        Fail
Name6            Bug3        Fail

I want to be able, on a given Google spreadsheet to select all rows containing distinct 'Bug name' columns, so the result should be the following :

Test Name  Bug name  Status
Name1            Bug1        Fail
Name3            Bug2        Fail
Name4            Bug3        Fail
Name5            Bug4        Fail


回答1:


Assuming you have the example table in range A1:C, I think the expected result could be achieved with this formula:

=ArrayFormula(iferror(vlookup(unique(B1:B),{B1:B,A1:C}, {2,3,4}, 0 )))

See if that helps ?



来源:https://stackoverflow.com/questions/30318460/selecting-all-rows-with-distinct-column-values-google-query-language

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