SubArray
The SubArray() function is used to create a new array from a partial area of an existing array.
Syntax
SubArray (Data Range, Rows, Columns)
Data Range | The range of data used as input |
Rows | Which rows to return |
Columns | Which columns to return |
Note:
Input parameters can consist of Quintessence functions. This includes functions that return ranges in cases where a parameter value can be a range.
Examples
Example 1. Create an array from part of an existing array
Example 2. Create an array from an existing array using the column headers
Note:
How your system administrator configured Quintessence determines which function parameters are required. In most implementations, administrators configure functions so that certain parameters default to specific values when left blank.
Example 1. Create an array from part of an existing array
The parameters for Rows and Columns are both arrays. In this example, the function returns Row 3 and Row 2. The order given in the parameter determines the order of the output. The Columns parameter is not utilised.
Input range | SubArray function | ||||
aaa | bbb | ccc | ddd | =SubArray(A2:D5,”3,2″) | |
eee | fff | ggg | hhh | ||
iii | jjj | kkk | lll | ||
mmm | nnn | ooo | ppp |
Input range | Output | |||||||
aaa | bbb | ccc | ddd | iii | jjj | kkk | lll | |
eee | fff | ggg | hhh | eee | fff | ggg | hhh | |
iii | jjj | kkk | lll | |||||
mmm | nnn | ooo | ppp |
In the next example, the function returns only Column 2. The Rows parameter is not utilised.
Input range | SubArray function | ||||
aaa | bbb | ccc | ddd | =SubArray(A2:D5,,”2″) | |
eee | fff | ggg | hhh | ||
iii | jjj | kkk | lll | ||
mmm | nnn | ooo | ppp |
Input range | Output | |||||||
aaa | bbb | ccc | ddd | bbb | ||||
eee | fff | ggg | hhh | fff | ||||
iii | jjj | kkk | lll | jjj | ||||
mmm | nnn | ooo | ppp | nnn |
When both the Rows and Columns parameter is utilised, the intersection of both is returned. In the next, the function returns the intersection of Row 3, Row 2 and Column 2.
Input range | SubArray function | ||||
aaa | bbb | ccc | ddd | =SubArray(A2:D5,”3,2″,”2″) | |
eee | fff | ggg | hhh | ||
iii | jjj | kkk | lll | ||
mmm | nnn | ooo | ppp |
Input range | Output | |||||||
aaa | bbb | ccc | ddd | jjj | ||||
eee | fff | ggg | hhh | fff | ||||
iii | jjj | kkk | lll | |||||
mmm | nnn | ooo | ppp |
SubArray supports the use of column headers as parameter values.
Input range | SubArray function | ||||
Minerals | Industrial | Gas | Cash | =SubArray(A2:D6,”2,4″,”[Gas],[Minerals]”) | |
938 | 477 | 678 | 752 | ||
58 | 13 | 687 | 710 | ||
76 | 205 | 27 | 545 | ||
331 | 472 | 695 | 297 |
Input range | Output | |||||||
Minerals | Industrial | Gas | Cash | Gas | Minerals | |||
938 | 477 | 678 | 752 | 687 | 58 | |||
58 | 13 | 687 | 710 | 695 | 331 | |||
76 | 205 | 27 | 545 | |||||
331 | 472 | 695 | 297 |