Topic: DMD0093 COUNTIFxx - Count If (EQ, NE, LT, LE, GT, GE) |
|
This instruction can only be used in the Expression parameter of the Calculate Expression (MATH) instruction.
The Count If (COUNTIFxx) math functions count the number of locations in the specified range that match the specified value by making the comparison in the function name. There are six variants of the CountIf math function, and all six have the following parameters:
Result specifies a location to store the result of the calculation. This can be any writable numeric location or an array reference, e.g. D [V0 ], (the array reference itself can be a math expression, e.g. D [ V0 +16 ]).
The Expression parameter consists of all the text between the bounding parentheses. The parameter list must consist of 2 parameters separated by a comma. Each parameter is an expression which can be a constant value, a bit or numeric memory location, an arithmetic expression, and / or mathematical function or other expressions up to a maximum of 1024 characters. Expressions can be nested, so use of parentheses is recommended to ensure proper evaluation order.
|
|
The following are the 6 variants of the COUNTIF math function: COUNTIFEQ - Count If Equal to ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is equal to 45.
COUNTIFNE - Count If Not Equal to ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is not equal to 45.
COUNTIFLT - Count If Less Than ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is less than 45.
COUNTIFLE - Count If Less Than or Equal to ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is less than or equal to 45.
COUNTIFGT - Count If Greater Than ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is greater than 45.
COUNTIFGE - Count If Greater Than or Equal to ExpressionIn the example below, D0 will contain the number of locations in the range of D100 through D109 that contain a value that is greater than or equal to 45.
|
|
See Also:
SUMIFxx - Sum If (EQ, NE, LT, LE, GT, GE)
COUNTIFxx - Count If (EQ, NE, LT, LE, GT, GE)
|
|
Rung Example:
|
|