0

I'm trying to add a cell reference (on the same sheet where the QUERY function is at) to a QUERY function

On B1 there is this value: 13/09/2019

QUERY function:

=QUERY(FORMULARIO!A1:S, "SELECT G WHERE Q contains '13/09/2019'")

I tried doing this but didnt work:

=QUERY(FORMULARIO!A1:S, "SELECT G WHERE Q contains '"&B2&"'")

I cant use a FILTER function here because I'm grabbing selected columns from the master sheet and changing the original order and FILTER doesn't allow that

What am I doing wrong?

3
  • What is the data type of the value on B2? Is it a date or a text value?
    – Rubén
    Sep 15, 2019 at 22:45
  • Good question by @Rubén. Please share a link to a test sheet. It would be great help. Sep 15, 2019 at 22:49
  • Can I get an example of the spreadsheet that you are using?
    – Xzila
    Sep 15, 2019 at 23:35

1 Answer 1

1

When dealing with dates in Google Sheets Query function, dates should be in a certain format.
They need to be as a string literal in the format yyyy-mm-dd, otherwise it can’t perform the comparison filter.

Query function needs dates in yyyy-mm-dd format

In your case your formula should read 2019-09-13
=QUERY(FORMULARIO!A1:S, "SELECT G WHERE Q contains '2019-09-13'")

1
  • What if he uses the date-serial instead? I.e. 9/13/2019 = 43721
    – Xzila
    Sep 15, 2019 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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