How to limit results returned by Query function in Google Spreadsheet

We had already seen brief introduction about using Query function in Google Spreadsheet. Let us see how to limit the number of rows returned using Query Function with the following sample data of batsman with maximum runs in test cricket.

Now if you want to get the top 3 batsman with maximum number of runs scored, then you can use

=QUERY(C3:G13,”select C,G limit 3″)

The limit keyword will reduce the number of results returned to 3.

But say if you want to get the list of top 3 batsman with maximum averages then need to use the Order by clause.

=QUERY(C3:G13,”select C,F order by F desc limit 3″)

The above query would first sort the list using Order by clause and then uses the limit keyword to get the Top results.

In Category: Technical

Ravi Shankar

A Software developer and blogger who is always looking to provide technical help to the wider community.

Show 0 Comments
No comments yet. Be the first.

Leave a Comment

Get your free copies of the following tech guides by joining the Digital Answers mailing list.