I have a Google sheet with 4 columns.
Column A contains a date, columns B and D contain a value.
I would like to display the top 3 values from the quotient column B / column D with the help of a query.
Saturdays should not be taken into account.
Here is the query:
=QUERY(ARRAYFORMULA({B2:B200/D2:D200; A2:A200}); “SELECT * WHERE Col2 IS NOT NULL AND Col2 <> 0 AND WEEKDAY(Col2) <> 7 ORDER BY Col1 DESC LIMIT 3”; 0)
An error message appears:
“Unable to parse query string for parameter 2 of function “QUERY”: PARSE_ERROR: Encountered “ <ID> ‘WEEKDAY ’” at line 1, column 51. Was expecting one of: “(” ... “(” ...”
Problem solution with ChatGPT was unsuccessful.
update1:
Here is the first query that still worked and that I built on. (without Date)
=QUERY(ARRAYFORMULA({B2:B200/D2:D200}); "SELECT * WHERE Col1 IS NOT NULL AND Col1 <> 0 ORDER BY Col1 DESC LIMIT 3"; 0)
and here are some other version that did not work either
=QUERY(ARRAYFORMULA({B2:B200/D2:D200,A2:A200}); "SELECT * WHERE Col1 IS NOT NULL AND Col1 <> 0 AND WEEKDAY(Col2) = 1 ORDER BY Col1 DESC LIMIT 3"; 0)
..with error message:
"Error
Error parsing the formula."
another one:
=QUERY(A150:A177; "SELECT A WHERE NOT(WEEKDAY(A150:A177) = 7)"; 1)
..and error message:
Error
Unable to parse the query string for parameter 2 of the “QUERY” function: PARSE_ERROR: Encountered “ <ID> ‘WEEKDAY ’” at line 1, column 20. Was expecting one of: “(” ... “(” ... “(” ... “(” ....