I use query to extract two columns from another sheet with data.

  • Column A has dates
  • Column B - numbers

I want to extract only rows that correspond to a specific calendar week number. For example 19. I use this query

=query(Database!A1:AD,"Select A,AB where WEEKNUM(A)=19",1)

But it returns #VALUE error. What is wrong?


weeknum is not a valid scalar function so you need to trick it like this:

=ARRAY_CONSTRAIN(ARRAYFORMULA(QUERY({A2:B, WEEKNUM(A2:A)}, "where Col3 = 21")), 999^99, 2)




| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.