between ()

Read(3093) Label: check, boolean value,

Description:

Check if Parameter1 is between Parameter 2 and Parameter 3 according to a passed-in parameter.

Syntax:

between(x,a:b)

Find if x falls between a and b. When no option is present the interval enclosed by a and b is closed.

Note:

The function checks whether x falls between a and b.

Parameter:

x/a/b

An expression that returns value of any data type that is capable of being compared, including numbers, strings, dates, and sequences.

Option:

@l

The interval is left-open and right-closed

@r

The interval is right-open and left-closed

@b

Make the function returns -1 if x<a; returns 1 if b<x; and return 0 for the rest of the cases

Return value:

Boolean value

Example:

 

A

 

1

=between(4,5:6)

false

2

=between(4,3:6)

true

3

=between(4,4:6)

true

4

=between@l(5,5:6)

false

5

=between@r(6,5:6)

false

6

=between@b(5,6:9)

-1

7

=between([1,2,3],[1,2]:[5,6])

true

8

=between("1990-06-08","1989-01-01":"1992-12-31")

true

Related functions:

if()

case()

string()