0
votes

How to take the current month number in the Select query in google sheets?

I am writing a query like this wherein Col21 I have month numbers like 1,2,3 4, etc based on month

=QUERY({Sheet1!A:X},"Select Col7,Col13 where Col21= '&month(today())&' ")

It is giving me headers only

whereas when I am writing a query like this :

=QUERY({Sheet1!A:X},"Select Col7,Col13 where Col21 contains '8' ")

It is giving me all records, but I want to replace the static value of month by Current month number only; what should I do for this so that when month changes I don't have to do any changes in the query.

1

1 Answers

0
votes

Please make sure Col21 is in number, not in string

=QUERY({Sheet1!A:X},"Select Col7,Col13 where Col21= "&month(today()))