问题
Google Sheets: I checked my column of dates is in DATE
format not Automatic
.
When I use MONTH
in a cell I get the correct month back from that column.
When I do a QUERY
such as =query('Main'!A1:M20,"select MONTH(M)",1)
I get #VALUE!
with the comment:
Unable to parse the Function
QUERY
for parameter 2: Can't perform the functionMONTH
on a column that is not aDATE
or aDATETIME
column
Why does QUERY
not see the column as being in DATE
format but =MONTH
does?
回答1:
months in a query are numbered and starts from 0, therefore, you will need to add +1 to get the first month and then do a weird logic: "where month1=month2" to get february (month(A)+1=3
for march, month(A)+1=12
for december, etc.)
=QUERY(A1:D10, "select A,B,C,D where month(A)+1=2", 1)
来源:https://stackoverflow.com/questions/54878095/google-sheets-month-works-but-month-in-query-does-not