thresholds



Function: thresholds()

Returns an array of arrays showing how much of an amount exceeds each of the given thresholds.

Syntax

thresholds(amount, listOfThresholds, keyValuesN)

ArgumentTypeDescription
amountIntegerThe amount to be evaluated against each threshold.
listOfThresholdsIntegerList of thresholds to be evaluated against the amount.
keyValuesNAnyAn array of key values of any type (Date, Number, String or Array). One for each threshold element.

Examples

Here, an amount of 50 will be evaluated to see how much it crosses thresholds of 0, 10 and 22.

thresholds(50, [0,10,22])

Returns:

[ [0,10], [10,12], [22,28] ]


Here, an amount of 50 will be evaluated to see how much of it crosses thresholds of 0, 10 and 22, with a key value of "A" associated to threshold 0, "B" to threshold 10 and "C" to threshold 22.

thresholds(50, [0,10,22], ["A","B","C"])

Returns: [ [0,"A",10], [10,"B",12], [22,"C",28] ]


Here, an amount of 15 will be evaluated to see how much it crosses thresholds of 10 and 20.

thresholds(15, [10,20])

Returns: [ [10,5] ]


Here, an amount of 15 will be evaluated to see how much it crosses thresholds of 20 and 30.

thresholds(15, [20,30])

Returns: _NULL, as the amount does not cross either threshold.

See Also