Ask Search:
Graham ClarkGraham Clark 

IF a field contains x, display z

I have a rollup field (WC Status) displaying the status of specific opportunities in a Text (comma separated) format. I need to create another formula field (Wine Club Status) to display only one of the values in the rollup field, based on whether or not the rollup field contains specific text. Here are the details.

If WC Status contains "Active", display "Active" in Wine Club Status. 
If WC Status contains "Canceled" but NOT "Active", display "Canceled" in Wine Club Status.
If WC Status is blank, leave Wine Club Status blank.

Thanks!
Best Answer chosen by Graham Clark
Eric SmithEric Smith
IF(CONTAINS(WC_Status__c,"Active"), "Active",
IF(CONTAINS(WC_Status__c,"Canceled"),"Cancelled",
""))

All Answers

Eric SmithEric Smith
IF(CONTAINS(WC_Status__c,"Active"), "Active",
IF(CONTAINS(WC_Status__c,"Canceled"),"Cancelled",
""))
This was selected as the best answer
Tony TrinhTony Trinh
Hello Graham,

Give this a try
IF(
CONTAINS(WC_Status__c, "Active"), "Active",
IF(
	AND(
		CONTAINS(WC_Status__c,"Canceled"),
		NOT(CONTAINS(WC_Status__c,"Active"))
	), "Canceled", 
null))

 
Eric SmithEric Smith
The AND is not required because if the field already contains "Active", the else statement will not get executed.
Tony TrinhTony Trinh
++Eric
True!
Graham ClarkGraham Clark
Works like a charm! Cheers!