Home > OS >  QUERY command WHERE parameter not finding match - format error?
QUERY command WHERE parameter not finding match - format error?

Time:08-09

The following command, =QUERY(J6:O, "Select J,K,L,M,N,O WHERE J= ' " &A2& " ' AND L>= date ' " & text(B2,"yyyy-mm-dd") & " ' AND L<= date ' " & text(C2,"yyyy-mm-dd") & " ' ") J= not matching values to A2, but when I hard code it into command then it work. J=211081 is working. Link to Sheet: enter image description here

CodePudding user response:

use:

=QUERY(J6:O, "where J = "&A2&" 
                and L >= date ' " & TEXT(B2, "yyyy-mm-dd")&"' 
                and L <= date ' " & TEXT(C2, "yyyy-mm-dd")&"'", )

if A2 cell and J column contain numeric values so you cant wrap A2 into single quotes. only plain text strings need such wrapping.

  • Related