The Greater Than symbol determines whether one numeric value is larger than another.
Syntax
number_1 > number_2
Number_1 and number_2 must be numeric values. (To compare string values, use STRCOMP.)
Return value
This command returns the numeric value of number_1 - number_2.
Notes
The Greater Than symbol is typically used with an IF command, as shown in the examples below.
To perform a comparison that is equivalent to "NOT GREATER THAN" or "LESS THAN OR EQUAL TO", use the Greater Than symbol in an IF command. The command for the action to take if number_1 is not greater than number_2 – or if number_1 is less than or equal to number_2 – should be placed in the False Part parameter of the IF command (after the second comma).
To perform a comparison that is equivalent to "GREATER THAN OR EQUAL TO", use the < symbol.
Note: To perform a comparison that always returns a 1 ("True") if number_1 > number_2 and always returns a 0 ("False") if number_1 <= number_2 , you must either perform a nested IF statement or multiple IF statements with numeric variables such as NVar or MyNVar. This is important when using Bitand (&) or Bitor (|). See the Examples below. |
Examples
IF ([A1] > 0), (MESSAGE "The number is greater than zero."), GOTO [B3]
If cell [A1] is greater than 0, display the message. Otherwise, go to cell [B3].
IF ([B1] > 0), "", (MESSAGE "The number is not greater than zero.")
This example performs a "NOT GREATER THAN" or "LESS THAN OR EQUAL TO" comparison.
If cell [B1] is not greater than 0, the message is displayed. Equivalently, if cell [B1] is less than or equal to 0, the message is displayed.
IF [A1] > 5, MyNVar "Comparison1" = 1, MyNVar "Comparison1" = 0 :
IF [B1] < 10, MyNVar "Comparison2" = 1, MyNVar "Comparison2" = 0 :
IF MyNVar "Comparison1" & MyNVar "Comparison2", "Department A", "Department B"
If cell [A1] is greater than 5 And cell [B1] is less than 10, return the string value "Department A". Otherwise, return the string value "Department B". This uses the Bitand operator.
IF (IF [A1] > 5, 1, 0) & (IF [B1] < 10, 1, 0), "Department A", "Department B"
If cell [A1] is greater than 5 And cell [B1] is less than 10, return the string value "Department A". Otherwise, return the string value "Department B". This uses the Bitand operator.
IF [A1] > 5, MyNVar "Comparison1" = 1, MyNVar "Comparison1" = 0 :
IF [B1] < 10, MyNVar "Comparison2" = 1, MyNVar "Comparison2" = 0 :
IF MyNVar "Comparison1" | MyNVar "Comparison2", "Department A", "Department B"
If cell [A1] is greater than 5 Or cell [B1] is less than 10, return the string value "Department A". Otherwise, return the string value "Department B". This uses the Bitor operator.
IF (IF [A1] > 5, 1, 0) | (IF [B1] < 10, 1, 0), "Department A", "Department B"
If cell [A1] is greater than 5 Or cell [B1] is less than 10, return the string value "Department A". Otherwise, return the string value "Department B". This uses the Bitor operator.