Investment Studio > Expressions > Functions > Reference > SUBARRAY

array[*][*] subarray(array[*][*] source_array, integer start_row, integer end_row, integer start_column, integer end_column)

Returns the specified part of source_array.

Valid start_row values range form 1 to the number of rows in source_array; valid end_row values range from start_row to the number of rows in source_array. Setting end_row = 0 is also allowed and returns all rows from start_row to last.

Valid start_column values range form 1 to the number of columns in source_array; valid end_column values range from start_column to the number of columns in source_array. Setting end_column = 0 is also allowed and returns all columns from start_column to last.

Examples

=subarray({"a", "b", "c", "d", "e"}, 1, 1, 3, 4)

returns {"c", "d"}

=subarray({{"a", "b", "c"}, {"d", "e", "f"}, {"g", "h", "i"}}, 2, 3, 2, 2)

returns {{"e"}, {"h"}}

=subarray({{"a", "b", "c"}, {"d", "e", "f"}, {"g", "h", "i"}}, 2, 0, 2, 0)

returns {{"e", "f"}, {"h", "i"}}.

See also array, choose, index.