google-sheetssumgoogle-sheets-formulagoogle-sheets-query

How can I sum top 5 values from column in Google Sheets


I have a simple table wherein A2-A100 I have numbers. I want to sum 5 highest numbers and save in A1. What is a proper query to do this? I tried to do QUERY with SELECT but I couldn't enforce to sum only the top 5 numbers.

-|----------|
 | A        |
-|----------|
1| Sum here |
2| 938      |
3| 124      |
4| 544      |
5| 453      |
6| 632      |
7| 324      |
8| ...more  |
-|----------|

Solution

  • Probably one of many ways:

    =sum(query(sort(A2:A100,1,false), "select Col1 limit 5",0))