function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Terry_0101Terry_0101 

Using EQUALS instead of CONTAINS

Hi Hi,

If I use CONTAINS, then the letters kent are mixed up with the United Kingdom's Kent state/province.

How to use equals Kentucky instead of contains?

IF(CONTAINS("Kentucky", State )
Jigar.LakhaniJigar.Lakhani
Hello,

I assume that "State" in your IF condition is comma separated string, since if it is set of strings then there is no issue it will automatically check the full word. But it might be comma separated string.

Two option is there

(1) You can convert your comma separated string to set of string like below
 
Set<String> setStates = new Set<String>();
String[] arrStates = State.Split(',');
for (String strState:arrStates) {
	setStates.Add(strState);
}

IF(CONTAINS("Kentucky", setStates)



(2) You can check comma with state name in IF condition

But before that you need to append comma in very first and last character like
 
State = ',' + State + ',';
IF(CONTAINS(',' + "Kentucky" + ',', State )


Thanks & Cheers,
Jigar(pateljb90@gmail.com)

Terry_0101Terry_0101
Here is my formula, so where do I insert your solution?

IF(OR(ISBLANK(State)), 
"",
IF(CONTAINS("Kentucky:West Virginia:Pennsylvania:Virginia:", State ),
"Eastern",
""))