Less than operator (<)
Value1
The first value to compare.
Value2
The second value to compare.
Returns
Whether the first value is less than the second value.
Returns whether the first value is less than the second value. 2 < 32 < 3 returns TRUE, as does "a" < "B""a" < "B". Text string comparisons are case-insensitive.
This operator also works with arrays. { 5, 7 } < 6{ 5; 7 } < 6 returns the array { TRUE, FALSE }{ TRUE; FALSE } (equivalent to { 5 < 6, 7 < 6 }{ 5 < 6; 7 < 6 }) and { 5, 7 } < { 6, 10 }{ 5; 7 } < { 6; 10 } returns the array { TRUE, TRUE }{ TRUE; TRUE } (equivalent to { 5 < 6, 7 < 10 }{ 5 < 6; 7 < 10 }).
FILTER, arrays and <
The logical arrays returned by this operator are especially useful with functions like FILTER, which takes an array and returns another array only containing certain elements.
This formula returns the array { 2 }{ 2 }:
4 is left out, because it is not less than 3.
The formula above works because { 2, 4 } < 3{ 2; 4 } < 3 is expanded to
the array { TRUE,
FALSE }{ TRUE;
FALSE } by the <
operator. As such, the formula
above is equivalent to this formula:
Comparison details
If two numbers are compared, the larger number is considered greater than the smaller number. If two logical values are compared, TRUE is considered greater than FALSE. If one of the two compared values is blank, the blank value is considered greater than the non-blank value.
Color values are compared by first converting them to the Hue-Saturation-Lightness-Alpha (HSLA) color space, as though the HSLA Calcapp function was used. (The "alpha" value denotes the extent to which the color is transparent or opaque.)
If two colors are compared which differ in terms of their alpha values, the less transparent color is considered greater than the other color. If they have the same alpha value, the hue is considered next, where a color with a greater hue value is considered greater than the other value. If they have the same alpha and hue values, the saturation is considered next, where a color with a greater saturation value is considered greater than the other value. Finally, if they have the same alpha, hue and saturation values, the lightness is considered, where a color with a greater lightness value is considered greater than the other value.
Text strings are compared using lexicographic ordering, which is mostly the same as dictionary order. Text strings are compared in a case-insensitive manner, which means that "a" < "B""a" < "B" returns TRUE, as does "A" < "b""A" < "b". This is different from how the SORT function works, which is case-sensitive.
When values of different types (say, numbers and text strings) are compared to one another, blank values are considered greater than numbers, which are considered greater than colors, which are considered greater than text strings, which in turn are considered greater than logical values.
Examples
Returns TRUE.
Returns FALSE.
Returns TRUE.
Returns TRUE. Text string comparisons are case-insensitive.
Returns TRUE. Text string comparisons are case-insensitive.
Returns the array { TRUE, FALSE }{ TRUE; FALSE }, equivalent to { 5 < 6, 7 < 6 }{ 5 < 6; 7 < 6 }.
Returns the array { TRUE, TRUE }{ TRUE; TRUE }, equivalent to { 5 < 6, 7 < 10 }{ 5 < 6; 7 < 10 }.