Excel SORT does not support an array of sort indexes or negative column indexes in the way described. The documented syntax is:
=SORT(array, [sort_index], [sort_order], [by_col])
where sort_index is a single number (one row or column to sort by), and sort_order is a single number (1 or -1). There is no built‑in option to pass something like:
=SORT(array, {3;-2;5;-1})
to represent multiple keys and sort directions.
For multi-key sorting based on other ranges/arrays, the supported approach is to use SORTBY, whose syntax is:
=SORTBY(array, by_array1, [sort_order1], [by_array2, sort_order2], …)
This allows multiple sort keys and independent sort orders, but each by_array must be a valid one-row or one-column range/array; negative indexes or CHOOSECOL-style index lists are not part of the function’s design.
To achieve complex multi-column sorting today, the supported options are:
- Use
SORTBY with explicit by_array arguments and sort_order values (1 or -1) for each key.
- Use helper arrays (e.g., via
CHOOSECOLS, REDUCE, etc.) to construct the by_array inputs, then feed them into SORTBY.
The requested compact SORT syntax with mixed positive/negative indexes is not available in the current documented behavior of SORT or SORTBY.
References: