Home > Software design >  Google Sheets Order By Query isnt showing any data
Google Sheets Order By Query isnt showing any data

Time:07-19

I am trying to bring in my list of employees from another file and have them sorted when they come in. When I do this:

=QUERY(importrange(K1, "Employees"), "Select *", 1)

Everything works great, but as soon as I add the order by method,

=QUERY(importrange(K1, "Employees"), "Select * order by Col4", 1)

It no longer works and just shows the header. Col4 is the correct column and if I use "Select Col4" all of the correct data shows up once again. Any idea of why this is happening?

CodePudding user response:

Try putting your IMPORTRANGE() function in curly brackets. I was able to reproduce (what I believe to be) a similar error in my sheet.

When I defined a range to query, it would not work when using "Col4". This did work when I used D, though. enter image description here

However, when I then placed the range into curly brackets, it understood Col4, and was able to order it. enter image description here


Given that you did not get an error and instead got no values, make sure that the values in the column you are sorting by are of one majority datatype.

For example:
ex

In this, the majority of column 4 are numbers, so when the data is sorted all the letters are left out.

My best advice is to simply check your datatypes. Dissimilar types won't sort properly with QUERY.

CodePudding user response:

Make sure the formatting of the source data is not mixed.

Example: Text, Number, ...
Format the columns in the same format to the last row.

  • Related