0
votes

My data in the range 'known' includes a column with the beginning year (E) and another with final year (F). I want to build a query to find the 10 entries that lasted longest. I started with
=QUERY(known,"SELECT A, B, F-E label F-E 'TopTen' " ,1) which works fine but I can't find a way of ordering F-E and limiting the results. ORDER BY and LIMIT don't seem to work. I want to avoid creating a new calculated field in the data itself. Grateful for any suggestions.

1
=QUERY(A:F,"SELECT A, B, F-E order by F-E desc limit 10 label F-E 'TopTen'" ,1) works for meTom Sharpe

1 Answers

0
votes

use:

=QUERY(A:F, "select A,B,F-E order by F-E desc limit 10 label F-E'TopTen'", 1)

as per the documentation, clauses follow specific ordering:

enter image description here