Top
Top (Array, No of rows)
Array | The input array |
No of rows | How many elements to return, counting forwards from the start of the array. |
Examples
Example 1. Return the top element of an array
Example 2. Return the top three elements of an array
Example 3. Use Top() in Excel in an expression
Consider the following input array:
Input array | ||
A | 1 | 11 |
B | 2 | 22 |
C | 3 | 33 |
D | 4 | 44 |
E | 5 | 55 |
F | 6 | 66 |
G | 7 | 77 |
Example 1. Return the top element of an array
This example returns a single element (row) from the top of the example input array above.
Function | ||
Top(Input Array,1) |
Output | ||
A | 1 | 11 |
Example 2. Return the top three elements of an array
This example returns three elements (rows) from the top of the example input array.
Function | ||
Top(Input Array,3) |
Output | ||
A | 1 | 11 |
B | 2 | 22 |
C | 3 | 33 |
Example 3. Use Top() in Excel in a Quintessence function
This example returns the cumulative sum of the rows in an array. The keyword ‘line‘ allows a line-by-line iteration through the array items (V1).
Range | Function |
1 | =Transform(A1:A5,”Sum(Top(V1,line))”) |
2 | |
3 | |
4 | |
5 |
Range | Output |
1 | 1 |
2 | 3 |
3 | 6 |
4 | 10 |
5 | 15 |