Home > Blockchain >  Google Sheets, query, select by month
Google Sheets, query, select by month

Time:10-19

I'm trying to select data by month but the behavior of the query/select is not what I expect. Here's a simplified sheet:

enter image description here

The month column just uses month() on column A and produces what I'd expect 1, 2, 3, 4

But the query in column D behaves as if the months are numbered 0, 1, 2, 3

What am I doing wrong?

CodePudding user response:

months in QUERY actually starts from 0 so your formula should be:

=QUERY(A:B, "select B where month(A) 1 = 1", )

or:

=QUERY(A:B, "select B where month(A) = 0", )

for getting January

documentation:

enter image description here

  • Related