Share via


IF (Report Builder)

Returns one value if a condition evaluates to TRUE and another value if a condition evaluates to FALSE. IF can have one or more than one condition/value pairs.

Syntax

IF(condition, value_if_true, value_if_false, …)

condition

Indicates the expression that can be evaluated to True or False.

value_if_true

Specifies the value that is returned if the condition is True.

value_if_false

Specifies the value that is returned if the condition is False.

Remarks

  • The condition must be a value or expression that can be evaluated to TRUE or FALSE.
  • Value_If_True represents the value returned if the condition is true.
  • Value_If_False represents the value returned if the condition is false.
  • If any of the arguments to IF are arrays, every element of the array is evaluated when the IF statement is carried out.

Example

Formula Result

IF(Sub Total >= 1000, "Discount", "No Discount")

If the customer's Sub Total is greater than or equal to 1000, the report displays Discount; otherwise, the report displays No Discount.

See Also

Concepts

Working with Formulas (Report Builder)
Using Functions (Report Builder)
Conditional Functions [(Report Builder)
Report Builder How-to Topics
Working with Literals in Formulas and Filters (Report Builder)
Formatting Data, Text, and Images (Report Builder)

Help and Information

Getting SQL Server 2005 Assistance