range2i(X;L)

Returns the number corresponding to which of the intervals, defined by a specified list of numbers, a given value falls.

Syntax

range2i(X;L)

Input

Argument Type Description
X any numeric type A scalar value or the name of a column
L any numeric type A scalar value

A comma- or space-separated list of numbers

Return Value

Returns an integer value indicating into which interval X falls. The intervals are defined by the list L.

If the list L has length n, the result is:
  • 0 if X is less than or equal to the least element in L
  • n if X is greater than the greatest element in L
  • a number between 1 and n-1 inclusive, otherwise

If X is N/A, the result is 0.

Sample Usage

value list range2i(value;list)
-5 0,10,25,50,100 0
10 0,10,25,50,100 1
30 0,10,25,50,100 3
75 0,10,25,50,100 4
200 0,10,25,50,100 5
10.5 0,10.25,25.25,50,100.75 2
0,10,25,50,100 0