Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Odd QUERY result in Google sheets?

I have a very simple query function in Google sheets, and I cannot understand why I’m getting the result it produces.

=QUERY(A4:C,"SELECT B WHERE A=’Active’ ")

It returns the data properly, except it also joins and transposes the first 64 entries of col B into the first cell of the query output. If I change the data range to A4:B, then the problem goes away, but I actually need it to extend past col C in the actual use case (I’ve pared down the data for the sample sheet). If I delete all of the data in col C the problem also goes away. I’ve also tried setting those rows to ‘Inactive’, but the problem persists. If I format col C as a number instead of automatic, then the problem goes away, but I still don’t understand why it would cause this problem in the first place.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Why am I seeing what I do in E2?

https://docs.google.com/spreadsheets/d/1pqHNBojMc97VYHPoZ-FyI85Qv8vrKuHS6CS_trL2gqI/

Thanks.

>Solution :

Instead of

=QUERY(A4:C,"SELECT B WHERE A='Active'")

Use

=QUERY(A4:C,"SELECT B WHERE A='Active'",0)

If you omit the last parameter. It tries to guess it and sometimes it guesses wrong.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading