2017-07-06 46 views
-1

我希望在Google查询中使用如下广义投影,但没有成功 = query('Form Responses 2'!A:N,“选择if(month(F)> 6,year(F),year (F)-1),N,B,C,D,E,F,G,H,I,J,K其中F> =日期'2011-07-01'和F < =日期'2050-06 -30'order by F desc,B“)如何在Google文档查询中使用广义投影?

希望以所需的方式在列F中列出Year。

请能帮助我解决这个问题。

回答

0

你需要把现有的列和新的列到一个数组

=arrayformula(query({A:N,if(isdate(F:F),if(month(F:F)>6,year(F:F),year(F:F)-1),F:F) },"Select Col15,Col14,Col2,Col3,Col4,Col5,Col7,Col8,Col9,Col10,Col11 where Col6 >= date '2011-07-01' and Col6 <= date '2050-06-30' order by Col6 desc, Col2",1)) 

我也不得不使用ISDATE(),因为如果你在你的表头一个月()和今年()函数会给出错误。