Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF-then-else with OR

Status
Not open for further replies.

Oona8

Technical User
Apr 3, 2002
25
FR
I want to be able to see "YES" when "Field1" = "Value1" or "Value2" or "Value"3 etc.. and "NO" when field1 = "Value4" or "Value5"
I suppose it's an IF THEN ELSE formula but how to deal with the "or" ? I read somewhere that it had to be avoided and to use IN instead. Does anybody know what I should do?

Thanks in advance!

Oona
 
Try this

if {field1} in ["value1","value2","value3"] then "yes" else
if {field1} in ["value4",value5"] then "no" else "maybe"

The "maybe" is there just in case a field failed the first 2 tests. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
If field 1 can be something other than value1 thru value5 use:

if {field1} in ["value1","value2","value3"] then "Yes" else
if {field1} in ["value4","value5"] then "No" else
""

If it can be only one of the 5 values you can use:

if {field1} in ["value1","value2","value3"] then "Yes" else
"No"

Mike

 
thanks a lot it works perfectly now!

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top