My query is only showing the first line of data when I order by asc, but it works normally when I filter by desc

Viewed 58

As you can see in column K

When I filter is by desc, it shows all of the data. Is there something I missing?

3 Answers

use:

=QUERY(dependentdata1, 
 "where X is not null 
  order by X asc 
  limit "&K2, 1)

Let's say this is your function:

=query(E2:G5, "select * order by E asc")

Your query looks like this and should work:

=query(E2:G5, "select * order by E desc")

So I am not sure what is wrong with yours.

However, you can trying wrapping it up with SORT and use the desc one since it works on your case.

=sort(query(E2:G5, "select * order by E desc"), 1, FALSE)

Sort Parameters:

  • 1st parameter = data
  • 2nd parameter = column to sort
  • 3rd parameter = TRUE (ascending), FALSE (descending)

Output:

output

My query is utilizing data from an =importdata function. So when the query updates, it seems to glitch out and only show the 1st row of data. I was able to revert it to a previous date where I was not having this issue and it did it when it updated. I'm sure there are some if functions I can use to resolve it, however, a =sortn function was able to allow me to place limits on what I wanted to sort and return =SORTN(U2:W, K2, TRUE)

Related