5 Replies Latest reply on Oct 5, 2018 11:54 AM by Sriram Chandra

# check multiple sub strings in a string

Hi.

I am trying to write a formula with CONTAINS

IF [Description]  contains only 'Call' then return 'C'

ELSEIF [Description] contains only 'Email' then return 'E'

ELSEIF [Description] contains both 'Call' and 'Email' then return 'B'

else [Decsription] contains neither words then return 'B'

end

thanks

sriram

• ###### 1. Re: check multiple sub strings in a string

Hello Sriram,

Without a workbook it's hard to tell but a structure similar to the below might work:

IF CONTAINS('Call',[Your Field Name]) THEN 'C'

ELSEIF CONTAINS('Email',[Your Field Name]) THEN 'E'

ELSEIF CONTAINS('Call',[Your Field Name]) AND CONTAINS('Email',[Customer Name]) THEN 'B'

ELSE 'B'

END

Thx, Don

• ###### 2. Re: check multiple sub strings in a string

Hello,

You can try below logic:

Formula=

IF [Description]="Call" then "C"

ELSEIF [Description]="Email" then "E"

ELSEIF  CONTAINS([Description],"Call") AND CONTAINS([Description],"Email") then "B"

ELSE "B"

END

• ###### 3. Re: check multiple sub strings in a string

Don,

I'm not sure, but I think the two-part conditional may need to come first:

IF CONTAINS('Call',[Your Field Name]) AND CONTAINS('Email',[Customer Name]) THEN 'B'

ELSEIF CONTAINS('Call',[Your Field Name]) THEN 'C'

ELSEIF CONTAINS('Email',[Your Field Name]) THEN 'E'

ELSE 'B'

END

Sriram,

If these are not meeting your needs, there is the whole other realm of RegEx:

1 of 1 people found this helpful
• ###### 4. Re: check multiple sub strings in a string

Hi Swaroop!

You're so right...thank you...great catch!  Don

• ###### 5. Re: check multiple sub strings in a string

Hi Swaroop,

Thanks!

Exactly this is what observed from my end and this solved the problem.

Thanks

Sriram