1
votes

I'm trying to get an integer value from another cell, A1, into my Google Sheets query:

=QUERY(B:F; "select B where F > "& A1 &"limit 1")

I get this error:

PARSE_ERROR: Encountered " "," ", "" at line 1, column 27. Was expecting one of: "group" ...

A1 contains a function =B1+C1 and that returns an integer. Though this query works if A1 is a hard-coded value like 100. I am not sure what is causing this error could be a parsing error or query error. Does anyone know how to fix it?

NOTES:

The referred cell, A1, has currency formatting in swedish krona(kr) that's not something custom. The regional settings are set to Sweden.

3

3 Answers

1
votes

try it like this:

=QUERY(B:F; "select B where F > '"& A1 &"' limit 1"; 0)

or with INDIRECT:

=QUERY(B:F; "select B where F > '"& INDIRECT("A1") &"' limit 1"; 0)
1
votes

There is a missing space before limit (it should be " limit 1" instad of "limit 1")

Instead of

=QUERY(B:F; "select B where F > "& A1 &"limit 1")

use

=QUERY(B:F; "select B where F > "& A1 &" limit 1")

Explanation

If the of A1 is an integer like 100 the resulting argument is

select B where F > 100limit 1

but that isn't a syntax supported for Google Query Language

0
votes

It works when you set the reference cell inside an Value(S13). It didn't work because of a bug in Google Sheets. Did try the query in another sheet, without Value(S13) and it worked, that confirms the bug.

This is the workaround query:

 =QUERY(B:F; "select B where F > "& Value(S13) &"limit 1")

The pseudo sheet for testing

enter image description here