Home : IF (Conditional statement)
Q10894 - INFO: IF (Conditional statement)

IF returns one value if a condition you specify is true and another value if that same condition evaluates to false.

SYNTAX:

IF(ConditionalStatement, TrueResult, FalseResult)
where :
ConditionalStatement is a logical statement comparing values such as variables, numbers and equations; usually including a comparison operator (<,>,=,<=,>=, etc.) or comparison function (i.e., TextEq can be used to compare text values).
TrueResult is the Expression to return if the conditional statement is evaluated as TRUE
FalseResult is the Expression returned if the conditional statement is evaluated as FALSE

NOTES:

TrueResult and FalseResult may be variable references, numeric values, numeric expressions (calculations) or other IF Statements (known as nested IF statements). 

True is defined as any non-zero value and False is zero.

EXAMPLES:

V134 = IF(V70 > 8, V71, V70)

The if statement above reads: IF variable 70 is greater than 8, return the contents of variable 71, otherwise, return the contents of variable 70:

IF(C15>10 AND C6>10,1,0) Returns 1 if the value for variable 15 is greater than 10 and the value for variable 6 is greater than 10. If either value is less than or equal to 10,  then the result will be 0.  See also AND operator.

IF(C15>10 OR C6>10,5,10) Returns 5 if the value for variable 15 is greater than 10 or the value for variable 6 is greater than 10.  See also OR operator.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 4/10/2008 3:14 PM.
Last Modified on 5/6/2009 8:37 PM.
Last Modified by Scott Dorner.
Article has been viewed 6392 times.
Rated 8 out of 10 based on 2 votes.
Print Article
Email Article