New ARRAYRANK Builtin Sorts Array Values
Version 9.1.2 will introduce the ARRAYRANK feature. Here is a preview of its capabilities.
The ARRAYRANK built-in can be very powerful for some applications. It allows you to order the values in an array from smallest to largest or vice-versa. In this sense, it expands upon what ARRAYMINIDX (find the index of the smallest value) and ARRAYMAXIDX (find the index of the largest value) already do.
To introduce ARRAYRANK, let’s look at a simple model that uses it. In this model, we explore the efficacy of applying tiered commissions for salespeople in an effort to encourage them to sell more. Each tier is designed as a reward so the top seller in any given week gets the highest percentage, while those who do not perform will get the lowest. The tiers are:
Top seller: 20%
2nd best seller: 15%
3rd best seller: 10%
Everyone else: 5%
Note that the non-tiered system gave everyone 10%. The model is very simple: