IF function

Function

IF{if_value1,result_value1,if_value2,result_value2,...,default_value}

If if_valueN is matched, this function returns the value of result_valueN. If there is no matching value, this function returns the default value default_value.

Parameters

if_valueN

Specify the condition (at least one is required).

You can specify the following: equality and inequality signs ("<", ">", "<=", ">=", "==", and "!="), "AND", "OR", and parentheses indicating the priorities for evaluating expressions ("(" and ")"). You cannot use the four basic arithmetic operations.

To specify the character strings, place the value between double quotation marks (").

You can also use $DSTR, $INUM, $INAME, $DNUM, $MINUM, and $VAR to specify this parameter.

result_valueN

Specify the result to be applied if the condition is met (at least one is required).

To specify the character strings, place the value between double quotation marks (").

You can also use $DSTR, $INUM, $INAME, $DNUM, $MINUM, and $VAR to specify this parameter.

default_value

Specify the value to be returned if no conditions are met. (This parameter cannot be omitted.)

To specify the character strings, place the value between double quotation marks (").

You can also use $DSTR, $INUM, $INAME, $DNUM, $MINUM, and $VAR to specify this parameter.

= Remarks =
  • if_valueN and result_valueN must be specified as a pair. If neither of them is specified, the function results in an error at the time of conversion.

  • If no condition is specified in if_valueN, the function results in an error at the time of conversion. Therefore, always specify this parameter. If equality and inequality signs are not specified (if only a value is specified), this function returns the value of result_valueN, assuming that the condition is matched.

  • In if_valueN, if date data is set in either of the values for comparison, the condition is evaluated with the values treated as date data. If a numeric value or numeric character string is set in either of the values for comparison, the condition is evaluated with the values treated as numeric data. In other cases, the values are compared as character string data.

  • You can specify a maximum of 255 arguments.

  • For each argument, you can specify up to 255 logical expressions that can be combined by AND/OR.

  • To use the IF function in Output Information Setting screen, mapping with input is required using the Set Mapping Information screen. However, the mapped input values are not used.

Note

If the data type specified in $INAME, $INUM, or $MINUM is type I, the function results in an error at the time of conversion.

Example

Figure A.8 Example of using the IF function