Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use query in Google spreadsheet to select column instead of row?

Please, need your help !!!

I tried

=query(A1:E6, "select * where D = 'Yes'", 0)

it will select the rows which in column D that has value 'Yes'.

My question is: how to select the columns which in row 2 that has value 'Yes'. I tried:

=query(A1:E6, "select * where 2 = 'Yes'", 0)

but it does not work :(

like image 507
user3228457 Avatar asked Apr 21 '14 18:04

user3228457


1 Answers

To do this with QUERY, you would need to do a double TRANSPOSE, or use an alternative like FILTER.

=TRANSPOSE(QUERY(TRANSPOSE(A1:E6),"select * where Col2 = 'Yes'",0))

or

=FILTER(A1:E6,A2:E2="Yes")

like image 102
AdamL Avatar answered Nov 15 '22 14:11

AdamL