Re: [Apps-Script] Multiple Query

109 views
Skip to first unread message

Martin Molloy

unread,
Dec 16, 2022, 9:38:59 AM12/16/22
to google-apps-sc...@googlegroups.com
Have you tried contains in lower case?


On Fri, 16 Dec 2022, 14:28 Sheki Metica, <evelyn...@sohomd.com> wrote:
Hi I am trying to create a query with multiple conditions. While it may work on my other sheets, this specific one I have will not accept my formula. I either get a formula parse error or Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "," ", "" at line 1, column 88. Was expecting one of: <EOF> "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ... "and" ... "or" ...

Formula am using:

=query(SortedData!B:N,"Select E, F, G, H, I, J, K, L where B CONTAINS '"&$A4&"' and C = '"&$F4&"' and M = '"&$I4&"',0)")


A4 is the department name
F4 is the Quarter 
I4 is the year

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f915c5a0-2605-4ec2-8f78-07f5dd70a59cn%40googlegroups.com.

Michael O'Shaughnessy

unread,
Dec 16, 2022, 6:03:12 PM12/16/22
to google-apps-sc...@googlegroups.com
I believe it is a "quote" issue... Take a look at this:
... M = '"&$I4&"',0)") 

You are closing your double quote after the parameter that is needed to tell how many header rows to expect.

Try changing it to this:
... M = '"&$I4&"'",0) 

This is adding the query's final double quote around the single quote for your I4 value.  then it has ,0 for no headers.

Look at them stacked on top of each other you should see where the difference is.

M = '"&$I4&"',0)")
M = '"&$I4&"'",0)

Give it a go and let us know if you are successful!

Reply all
Reply to author
Forward
0 new messages